File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export default function withAuth(/* additionnal args if needed */) {
1616
1717 return (
1818 < AuthContextConsumer >
19- { ( fromAuthProps : AuthContextProps ) => (
19+ { ( fromAuthProps : Partial < AuthContextProps > ) => (
2020 < BaseComponent { ...fromAuthProps } { ...passProps } />
2121 ) }
2222 </ AuthContextConsumer >
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { AuthContextProvider, AuthData } from '../context';
33import auth from '../../../services/auth' ;
44import { devToolsStore } from '../../withDevTools' ;
55
6- // #region types
6+ // #region types
77export type AuthProviderProps = {
88 initialState : { } & AuthData ;
99} ;
@@ -68,19 +68,17 @@ export default class AuthProvider extends Component<
6868 // #endregion
6969
7070 checkIsAuthenticated = ( ) : boolean => {
71- const checkUserHasId = ( user : User ) => user ? .id ?? '' ;
71+ const checkUserHasId = ( user : User ) => user . id ;
7272 const user = auth . getUserInfo ( ) ? auth . getUserInfo ( ) : null ;
73- const isAuthenticated = auth . getToken ( ) && checkUserHasId ( user ) ;
73+ const isAuthenticated = ! ! ( auth . getToken ( ) && checkUserHasId ( user ) ) ;
7474
7575 devToolsStore &&
7676 devToolsStore . dispatch ( {
7777 type : 'AUTH_CHECK_IS_AUTHENTICATED' ,
7878 state : { ...this . state , isAuthenticated } ,
7979 } ) ;
8080
81- this . setState ( {
82- isAuthenticated,
83- } ) ;
81+ this . setState ( { isAuthenticated } ) ;
8482 return isAuthenticated ;
8583 } ;
8684
@@ -94,9 +92,7 @@ export default class AuthProvider extends Component<
9492 state : { ...this . state , isExpiredToken } ,
9593 } ) ;
9694
97- this . setState ( {
98- isExpiredToken,
99- } ) ;
95+ this . setState ( { isExpiredToken } ) ;
10096 return isExpiredToken ;
10197 } ;
10298
You can’t perform that action at this time.
0 commit comments