Generateurv2/frontend/apis/exoInstance.instance.js

17 lines
533 B
JavaScript
Raw Normal View History

2022-05-18 10:15:54 +02:00
import axios from "axios";
2022-06-11 23:39:03 +02:00
import { csrftoken, isBrowser } from "../utils/utils.js";
2022-05-18 10:15:54 +02:00
export const exoInstance = axios.create({
baseURL: `${process.env.NEXT_PUBLIC_HOST}/api/exos/`,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
2022-06-11 23:39:03 +02:00
"X-CSRFToken": csrftoken != undefined ? csrftoken : "",
Authorization: isBrowser
? localStorage.getItem("token") !== null
? `Token ${localStorage.getItem("token")}`
: null
: null,
2022-05-18 10:15:54 +02:00
},
});