|
|
|
|
@ -15,9 +15,15 @@ export const api = axios.create({
|
|
|
|
|
import.meta.env.MODE === "development"
|
|
|
|
|
? "http://localhost:5173/"
|
|
|
|
|
: BASE_URL,
|
|
|
|
|
withCredentials: true,
|
|
|
|
|
xsrfHeaderName: "X-CSRFToken",
|
|
|
|
|
xsrfCookieName: "csrftoken",
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
api.interceptors.request.use(function (config) {
|
|
|
|
|
const token = localStorage.getItem("access_token");
|
|
|
|
|
if (token) {
|
|
|
|
|
config.headers.Authorization = `Bearer ${token}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const useDbTableName = () => {
|
|
|
|
|
@ -215,7 +221,7 @@ export const useGetPermissions = () => {
|
|
|
|
|
return useQuery(["permissions"], async () => {
|
|
|
|
|
const { data } = await api.get("/api/me/");
|
|
|
|
|
|
|
|
|
|
if (data?.groups?.includes("Редактор")) {
|
|
|
|
|
if (data?.groups?.includes("postnet_editor")) {
|
|
|
|
|
return "editor";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|