File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,8 +29,9 @@ export const authApi = baseApi.injectEndpoints({
2929 method : 'POST' ,
3030 body,
3131 } ) ,
32- async onQueryStarted ( _ , { queryFulfilled, extra } ) {
32+ async onQueryStarted ( _ , { queryFulfilled, extra, dispatch } ) {
3333 try {
34+ dispatch ( baseApi . util . resetApiState ( ) ) ;
3435 const result = await queryFulfilled ;
3536 setToLS ( LS_ACCESS_TOKEN_KEY , result . data . access_token ) ;
3637 const typedExtra = extra as ExtraArgument ;
@@ -93,8 +94,10 @@ export const authApi = baseApi.injectEndpoints({
9394 removeFromLS ( LS_ACCESS_TOKEN_KEY ) ;
9495 const typedExtra = extra as ExtraArgument ;
9596 typedExtra . navigate ( ROUTES . auth . login . page ) ;
96- dispatch ( baseApi . util . resetApiState ( ) ) ;
97- dispatch ( clearStore ( ) ) ;
97+ setTimeout ( ( ) => {
98+ dispatch ( baseApi . util . resetApiState ( ) ) ;
99+ dispatch ( clearStore ( ) ) ;
100+ } , 0 ) ;
98101 } catch ( error ) {
99102 // eslint-disable-next-line no-console
100103 console . error ( error ) ;
You can’t perform that action at this time.
0 commit comments