@@ -173,7 +173,7 @@ export const refreshTokensThunk = createAsyncThunk<void, void, { state: RootStat
173173 logger . info ( 'Auth tokens refresh failed: ' , JSON . stringify ( err ) ) ;
174174 asyncStorageService . clearStorage ( ) ;
175175 dispatch ( authActions . setLoggedIn ( false ) ) ;
176- dispatch ( authThunks . signOutThunk ( ) ) ;
176+ dispatch ( authThunks . signOutThunk ( { reason : 'token_expired' } ) ) ;
177177 }
178178 } ,
179179) ;
@@ -197,18 +197,20 @@ export const checkAndRefreshTokenThunk = createAsyncThunk<void, void, { state: R
197197 } ,
198198) ;
199199
200- export const signOutThunk = createAsyncThunk < void , void , { state : RootState } > (
201- 'auth/signOut' ,
202- async ( _ , { dispatch } ) => {
203- authService . signout ( ) . catch ( errorService . reportError ) ;
204- drive . clear ( ) . catch ( errorService . reportError ) ;
205- dispatch ( uiActions . resetState ( ) ) ;
206- dispatch ( authActions . resetState ( ) ) ;
207- dispatch ( driveActions . resetState ( ) ) ;
208- dispatch ( authActions . setLoggedIn ( false ) ) ;
209- authService . emitLogoutEvent ( ) ;
210- } ,
211- ) ;
200+ export const signOutThunk = createAsyncThunk <
201+ void ,
202+ { reason : 'manual' | 'unauthorized' | 'token_expired' } ,
203+ { state : RootState }
204+ > ( 'auth/signOut' , async ( payload , { dispatch } ) => {
205+ const reason = payload . reason ;
206+ authService . signout ( reason ) . catch ( errorService . reportError ) ;
207+ drive . clear ( ) . catch ( errorService . reportError ) ;
208+ dispatch ( uiActions . resetState ( ) ) ;
209+ dispatch ( authActions . resetState ( ) ) ;
210+ dispatch ( driveActions . resetState ( ) ) ;
211+ dispatch ( authActions . setLoggedIn ( false ) ) ;
212+ authService . emitLogoutEvent ( ) ;
213+ } ) ;
212214
213215export const refreshUserThunk = createAsyncThunk < void , void , { state : RootState } > (
214216 'auth/refreshUser' ,
0 commit comments