fixed search

This commit is contained in:
HotSwapp
2025-08-11 11:26:16 -05:00
parent 85ce0f82ec
commit 278eb7c5d4
3 changed files with 53 additions and 43 deletions

View File

@@ -42,6 +42,16 @@
headers.set(CORRELATION_HEADER, outgoingCid);
}
// Inject Authorization header if JWT token is available and not already provided
try {
const storedToken = (window.app && window.app.token) || (typeof localStorage !== 'undefined' && localStorage.getItem('auth_token'));
if (storedToken && !headers.has('Authorization')) {
headers.set('Authorization', `Bearer ${storedToken}`);
}
} catch (_) {
// Ignore storage access errors (e.g., privacy mode)
}
const requestInit = { ...options, headers };
const response = await originalFetch(resource, requestInit);