File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11import { InternalAxiosRequestConfig } from 'axios'
22import { API_ENDPOINT } from 'src/config'
3- import { getUserToken } from 'src/features/auth'
43import { isProduction } from 'src/utils/Environment'
4+ import { firebaseAuth } from '../firebase'
55
66export async function DefaultRequestInterceptor ( config : InternalAxiosRequestConfig ) {
77 if ( config ) {
@@ -20,3 +20,18 @@ export async function DefaultRequestInterceptor(config: InternalAxiosRequestConf
2020
2121 return config
2222}
23+
24+ const getUserToken = async ( ) => {
25+ return new Promise ( ( resolve , _ ) => {
26+ const unsub = firebaseAuth . onAuthStateChanged ( async ( user ) => {
27+ if ( user ) {
28+ const token = await user . getIdToken ( )
29+ resolve ( token )
30+ } else {
31+ resolve ( null )
32+ }
33+ unsub ( )
34+ } )
35+ resolve ( 'abc' )
36+ } )
37+ }
You can’t perform that action at this time.
0 commit comments