erm what the sigma

This commit is contained in:
NotII
2025-03-24 13:44:44 +00:00
parent edcd0c1e06
commit f5b5608f9d
2 changed files with 21 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
/**
<<<<<<< Updated upstream
<<<<<<< Updated upstream
* API utilities for consistent request handling
*/
@@ -35,6 +36,8 @@ export function getServerApiUrl(endpoint: string): string {
? `${apiUrl}${cleanEndpoint}`
: `${apiUrl}/${cleanEndpoint}`;
=======
=======
>>>>>>> Stashed changes
* API utilities for client and server-side requests
*/
@@ -71,25 +74,35 @@ export function getServerApiUrl(endpoint: string): string {
const normalizedEndpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
return `${normalizedBaseUrl}${normalizedEndpoint}`;
<<<<<<< Updated upstream
>>>>>>> Stashed changes
=======
>>>>>>> Stashed changes
}
/**
* Get the authentication token from cookies or localStorage
<<<<<<< Updated upstream
<<<<<<< Updated upstream
*/
export function getAuthToken(): string | null {
if (typeof document === 'undefined') return null; // Guard for SSR
=======
=======
>>>>>>> Stashed changes
* Only available in client-side code
*/
export function getAuthToken(): string | null {
if (typeof document === 'undefined') return null;
<<<<<<< Updated upstream
>>>>>>> Stashed changes
=======
>>>>>>> Stashed changes
return document.cookie
.split('; ')
.find(row => row.startsWith('Authorization='))
<<<<<<< Updated upstream
<<<<<<< Updated upstream
?.split('=')[1] || localStorage.getItem('Authorization');
}
@@ -120,6 +133,8 @@ export function createApiHeaders(token?: string | null, customHeaders: Record<st
}
=======
=======
>>>>>>> Stashed changes
?.split('=')[1] ||
(typeof localStorage !== 'undefined' ? localStorage.getItem('Authorization') : null);
}
@@ -140,6 +155,9 @@ export function createApiHeaders(token: string | null = null, additionalHeaders:
headers.append('Authorization', `Bearer ${authToken}`);
}
<<<<<<< Updated upstream
>>>>>>> Stashed changes
=======
>>>>>>> Stashed changes
return headers;
}