mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add client header
This commit is contained in:
parent
9fa6683675
commit
91ecc99f37
1 changed files with 3 additions and 6 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue