18 lines
541 B
JavaScript
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,
|
||
|
},
|
||
|
});
|