Generateurv2/frontend/apis/users.instance.js
Kilton937342 035af2a3b7 modifs
2022-06-11 23:39:03 +02:00

18 lines
541 B
JavaScript

import axios from "axios";
import { csrftoken, isBrowser } from "../utils/utils.js";
export const usersInstance = axios.create({
baseURL: `${process.env.NEXT_PUBLIC_HOST}/api/users/auth`,
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,
},
});