Generateurv2/frontend/apis/roomInstance.intance.js

18 lines
535 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 roomInstance = axios.create({
baseURL: `${process.env.NEXT_PUBLIC_HOST}/api/room/`,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
"X-CSRFToken": csrftoken != undefined ? csrftoken : "",
2022-06-11 23:39:03 +02:00
Authorization: isBrowser
? localStorage.getItem("token") !== null
? `Token ${localStorage.getItem("token")}`
: null
: null,
2022-05-18 10:15:54 +02:00
},
});