Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import store from 'store'
- import axios from 'axios'
- const API_BASE_URL = process.env.API_BASE_URL
- export const api = {
- login (data) {
- return axios({
- method: 'post',
- url: `${API_BASE_URL}/api-token-auth`,
- data
- })
- },
- get (entrypoint) {
- return axios({
- method: 'get',
- url: `${API_BASE_URL}/${entrypoint}`,
- headers: {
- 'Authorization': 'JWT ' + store.getState().auth.token
- }
- })
- },
- post (entrypoint, data) {
- return axios({
- method: 'post',
- url: `${API_BASE_URL}/${entrypoint}`,
- headers: {
- 'Authorization': 'JWT ' + store.getState().auth.token
- },
- data
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement