Add client header

This commit is contained in:
Jackson Harper
2024-05-07 12:10:22 +08:00
parent 9fa6683675
commit 91ecc99f37

View File

@ -12,24 +12,21 @@ export type RequestContext = {
}
}
type RequestHeaders = {
authorization?: string
pendingUserAuth?: string
}
function requestHeaders(): RequestHeaders {
function requestHeaders(): Record<string, string> {
const authToken = window?.localStorage.getItem('authToken') || undefined
const pendingAuthToken =
window?.localStorage.getItem('pendingUserAuth') || undefined
if (authToken) {
return {
'X-OmnivoreClient': 'web',
authorization: authToken,
}
}
if (pendingAuthToken) {
return {
'X-OmnivoreClient': 'web',
pendingUserAuth: pendingAuthToken,
}
}