add slug in header requests

This commit is contained in:
hamid zarghami
2025-12-09 12:54:23 +03:30
parent 497d54d8b3
commit abf2dceabf
+10
View File
@@ -101,7 +101,17 @@ axiosInstance.interceptors.request.use(async function (config) {
const tokenValue = await getToken();
const token = tokenValue ? tokenValue : "";
let slug = "dmenu";
if (typeof window !== "undefined") {
const pathname = window.location.pathname;
const pathParts = pathname.split("/").filter(Boolean);
if (pathParts.length > 0) {
slug = pathParts[0];
}
}
config.headers.Authorization = "Bearer " + token;
config.headers["X-SLUG"] = slug;
return config;
});