passing token in missing headers

This commit is contained in:
2026-04-02 21:16:56 +05:30
parent 4b0d9ca425
commit 1f64b566cb

View File

@@ -5,6 +5,9 @@ export function attachAuthInterceptors(client: AxiosInstance) {
client.interceptors.request.use((config) => { client.interceptors.request.use((config) => {
const token = tokenStore.get(); const token = tokenStore.get();
if (token) { if (token) {
if (!config.headers) {
(config as any).headers = {};
}
config.headers.Authorization = `Bearer ${token}`; config.headers.Authorization = `Bearer ${token}`;
} }
return config; return config;