File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { createAsyncActions } from '@foxcomm/wings';
55import { dissoc , merge , update } from 'sprout-data' ;
66import { api } from 'lib/api' ;
77import { setUserId } from 'lib/analytics' ;
8+ import { replace } from 'react-router-redux' ;
89
910import type { asyncAction } from 'types' ;
1011
@@ -61,10 +62,15 @@ export function googleSignin(): asyncAction<void> {
6162}
6263
6364export const logout = createAsyncActions ( 'auth-logout' , function logout ( ) : Promise {
65+ const { getState, dispatch } = this ;
6466 return api . auth . logout ( )
6567 . then ( ( ) => {
68+ const { routing } = getState ( ) ;
6669 api . removeAuth ( ) ;
6770 this . dispatch ( logoutAction ( ) ) ;
71+ if ( routing && routing . location . pathname . startsWith ( '/profile' ) ) {
72+ dispatch ( replace ( '/' ) ) ;
73+ }
6874 } ) ;
6975} ) . perform ;
7076
You can’t perform that action at this time.
0 commit comments