diff options
Diffstat (limited to 'src/api/utils/auth.ts')
-rw-r--r-- | src/api/utils/auth.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/api/utils/auth.ts b/src/api/utils/auth.ts index 282d00459..1f694a781 100644 --- a/src/api/utils/auth.ts +++ b/src/api/utils/auth.ts | |||
@@ -31,15 +31,17 @@ export const prepareAuthRequest = ( | |||
31 | return request; | 31 | return request; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | export const prepareLocalToken = async ( | 34 | export const prepareLocalToken = async (requestData: { |
35 | requestData: { method: string; headers?: any; body?: any }, | 35 | method: string; |
36 | ) => { | 36 | headers?: any; |
37 | body?: any; | ||
38 | }) => { | ||
37 | await when(() => !needsToken() || !!localServerToken(), { timeout: 2000 }); | 39 | await when(() => !needsToken() || !!localServerToken(), { timeout: 2000 }); |
38 | const token = localServerToken(); | 40 | const token = localServerToken(); |
39 | if (token) { | 41 | if (token) { |
40 | requestData.headers['X-Ferdium-Local-Token'] = token; | 42 | requestData.headers['X-Ferdium-Local-Token'] = token; |
41 | } | 43 | } |
42 | } | 44 | }; |
43 | 45 | ||
44 | export const sendAuthRequest = async ( | 46 | export const sendAuthRequest = async ( |
45 | url: RequestInfo, | 47 | url: RequestInfo, |