@batimentb/vadimm-js-api
v1.80.9
Published
Javascript client for using Vadimm API, build with axios
Downloads
17
Keywords
Readme
Vadimm Javascript API
javascript client for using vadimm api for Vue.JS
Getting Started
import Api from '@batimentb/vadimm-js-api'
const API_HOST = process.env.VUE_APP_API_HOST || 'https://vadimm-api-dev.scalingo.io'
Vue.use(Api, { host: API_HOST })
Usages examples
Retrieve token and Login
let request = await this.$api.login(email, password)
const token = request.data.auth_token
this.$api.setToken(token)
Fetch a list of resources
import { RESOURCES } from '@batimentb/vadimm-js-api'
let request = await this.$api.get(RESOURCES.PROGRAMS)
Fetch only one resource
import { RESOURCES } from '@batimentb/vadimm-js-api'
let request = await this.$api.getOne(RESOURCES.PROGRAMS, program.pk)
Create a new resource
import { RESOURCES } from '@batimentb/vadimm-js-api'
let request = await this.$api.post(RESOURCES.PROGRAMS, payload)
Update an existing resource
import { RESOURCES } from '@batimentb/vadimm-js-api'
let request = await this.$api.put(RESOURCES.PROGRAMS, program.pk, payload)
OR
import { RESOURCES } from '@batimentb/vadimm-js-api'
let request = await this.$api.patch(RESOURCES.PROGRAMS, program.pk, payload)
Publish on NPM
- npm login (log on keyweb)
- email [email protected]
- update package.json version
- npm publish