Generateurv2/frontend/apis/roomInstance.intance.js
Kilton937342 d41d41596d te
2022-08-02 14:17:14 +02:00

18 lines
542 B
JavaScript

import axios from "axios";
import { csrftoken, isBrowser } from "../utils/utils.js";
export const roomInstance = axios.create({
baseURL: `http://${process.env.NEXT_PUBLIC_HOST}/api/room/`,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
"X-CSRFToken": csrftoken != undefined ? csrftoken : "",
Authorization: isBrowser
? localStorage.getItem("token") !== null
? `Token ${localStorage.getItem("token")}`
: null
: null,
},
});