|
@@ -2,20 +2,28 @@ import WSport from "@widgets/WSport";
|
|
|
import {useEffect, useState} from "react";
|
|
import {useEffect, useState} from "react";
|
|
|
import {reqGameInfo} from "@features/api";
|
|
import {reqGameInfo} from "@features/api";
|
|
|
import LoadingIn from "@components/Loading/LoadingIn";
|
|
import LoadingIn from "@components/Loading/LoadingIn";
|
|
|
-import {useDispatch} from "react-redux";
|
|
|
|
|
|
|
+import {useDispatch, useSelector} from "react-redux";
|
|
|
import {useLocation} from "react-router-dom";
|
|
import {useLocation} from "react-router-dom";
|
|
|
import {ROUTE_PATH} from "@constants/routes";
|
|
import {ROUTE_PATH} from "@constants/routes";
|
|
|
|
|
+import {isLogined} from "@features/mainSlice";
|
|
|
|
|
|
|
|
const Sport = ({...props}) => {
|
|
const Sport = ({...props}) => {
|
|
|
const [isReToken, setIsReToken] = useState(false);
|
|
const [isReToken, setIsReToken] = useState(false);
|
|
|
const [isSrcLoaded, setIsSrcLoaded] = useState(false);
|
|
const [isSrcLoaded, setIsSrcLoaded] = useState(false);
|
|
|
const dispatch = useDispatch();
|
|
const dispatch = useDispatch();
|
|
|
const {pathname} = useLocation();
|
|
const {pathname} = useLocation();
|
|
|
|
|
+ const isLogin=useSelector(isLogined);
|
|
|
const initSport=()=>{
|
|
const initSport=()=>{
|
|
|
setIsReToken(false);
|
|
setIsReToken(false);
|
|
|
- dispatch(reqGameInfo()).then(({payload})=>{
|
|
|
|
|
|
|
+ if (isLogin){
|
|
|
|
|
+ dispatch(reqGameInfo()).then(({payload})=>{
|
|
|
|
|
+ setIsReToken(true);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
setIsReToken(true);
|
|
setIsReToken(true);
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
const resetSport=()=>{
|
|
const resetSport=()=>{
|
|
|
initSport();
|
|
initSport();
|