vikunja-frontend/src/http-common/index.ts
2022-04-02 17:14:59 +02:00

18 lines
370 B
TypeScript

import axios from 'axios'
import {getToken} from '@/helpers/auth'
export function HTTPFactory() {
return axios.create({
baseURL: window.API_URL,
})
}
export function AuthenticatedHTTPFactory(token = getToken()) {
return axios.create({
baseURL: window.API_URL,
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
})
}