diff --git a/src/lib/api/axiosInstance.ts b/src/lib/api/axiosInstance.ts index c2d51e3..bac6542 100644 --- a/src/lib/api/axiosInstance.ts +++ b/src/lib/api/axiosInstance.ts @@ -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; });