File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { authStore } from "../../stores/AuthStore" ;
2
+
1
3
/**
2
4
* Check if code is running in a browser environment
3
5
* @returns {boolean } True if running in browser, false otherwise
@@ -21,8 +23,7 @@ export const getChartUrl = (): string => {
21
23
} ;
22
24
23
25
export const isLogged = ( ) : boolean => {
24
- const token = localStorage . getItem ( "auth_token" ) ;
25
- return ! ! token ;
26
+ return authStore . isAuthenticated ;
26
27
} ;
27
28
28
29
export const getUrlBase = ( path : string = "" ) : string => {
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
import { Button , Heading } from "@deriv-com/quill-ui" ;
3
+ import { useNavigate } from "react-router-dom" ;
3
4
import { authStore } from "../../stores/AuthStore" ;
4
5
import { isLogged } from "../../common/utils" ;
5
6
import "./homepage.scss" ;
6
7
7
8
const Homepage : React . FC = ( ) => {
9
+ const navigate = useNavigate ( ) ;
8
10
return (
9
11
< div className = "homepage" >
10
12
< div className = "homepage__content" >
@@ -19,7 +21,7 @@ const Homepage: React.FC = () => {
19
21
< Button
20
22
onClick = { ( ) => {
21
23
if ( isLogged ( ) ) {
22
- window . location . href = "/dashboard" ;
24
+ navigate ( "/dashboard" ) ;
23
25
} else {
24
26
authStore . login ( ) ;
25
27
}
You can’t perform that action at this time.
0 commit comments