From abf2dceabf8c3063d22e00deb1e0d54cd1edd4b7 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Tue, 9 Dec 2025 12:54:23 +0330 Subject: [PATCH] add slug in header requests --- src/lib/api/axiosInstance.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; });