2018-09-06 19:46:09 +02:00
|
|
|
import axios from 'axios'
|
2022-01-14 21:52:00 +01:00
|
|
|
import {getToken} from '@/helpers/auth'
|
2018-09-06 19:46:09 +02:00
|
|
|
|
2022-01-14 21:52:00 +01:00
|
|
|
export function HTTPFactory() {
|
2020-10-11 12:13:35 +02:00
|
|
|
return axios.create({
|
|
|
|
baseURL: window.API_URL,
|
|
|
|
})
|
|
|
|
}
|
2022-01-14 21:52:00 +01:00
|
|
|
|
|
|
|
export function AuthenticatedHTTPFactory(token = getToken()) {
|
|
|
|
return axios.create({
|
|
|
|
baseURL: window.API_URL,
|
|
|
|
headers: {
|
|
|
|
Authorization: `Bearer ${token}`,
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|