File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,17 @@ import { getUserInfo } from '../services/auth';
9
9
// isLoading: boolean;
10
10
// }
11
11
12
- const AuthContext = createContext ( undefined ) ;
12
+ interface AuthContextType {
13
+ user : any ;
14
+ setUser : React . Dispatch < any > ;
15
+ refreshUser : ( ) => Promise < void > ;
16
+ isLoading : boolean ;
17
+ }
13
18
14
- export const AuthProvider = ( { children } ) => {
15
- const [ user , setUser ] = useState ( null ) ;
19
+ const AuthContext = createContext < AuthContextType | undefined > ( undefined ) ;
20
+
21
+ export const AuthProvider : React . FC < React . PropsWithChildren < object > > = ( { children } ) => {
22
+ const [ user , setUser ] = useState < any > ( null ) ;
16
23
const [ isLoading , setIsLoading ] = useState ( true ) ;
17
24
18
25
const refreshUser = async ( ) => {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import { UserData } from '../../../types/models';
20
20
21
21
const useStyles = makeStyles ( styles ) ;
22
22
23
- const DashboardNavbarLinks : React . FC = ( ) => {
23
+ export const DashboardNavbarLinks : React . FC = ( ) => {
24
24
const classes = useStyles ( ) ;
25
25
const navigate = useNavigate ( ) ;
26
26
const [ openProfile , setOpenProfile ] = useState < HTMLElement | null > ( null ) ;
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ const Login: React.FC = () => {
64
64
window . sessionStorage . setItem ( 'git.proxy.login' , 'success' ) ;
65
65
setMessage ( 'Success!' ) ;
66
66
setSuccess ( true ) ;
67
- refreshUser ( ) ;
67
+ refreshUser ( ) . then ( ( ) => navigate ( '/dashboard/repo' ) ) ;
68
68
} )
69
69
. catch ( ( error : AxiosError ) => {
70
70
if ( error . response ?. status === 307 ) {
You can’t perform that action at this time.
0 commit comments