|
@@ -1,10 +1,10 @@
|
|
|
import styles from './styles.module.scss'
|
|
import styles from './styles.module.scss'
|
|
|
-import {useEffect, useRef} from "react";
|
|
|
|
|
|
|
+import {useEffect, useRef, useState} from "react";
|
|
|
import {useThemeProvider} from "@contexts/themeContext";
|
|
import {useThemeProvider} from "@contexts/themeContext";
|
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
|
import {getBBConf, getUserID, getUserInfo} from "@features/mainSlice";
|
|
import {getBBConf, getUserID, getUserInfo} from "@features/mainSlice";
|
|
|
import {APP_THEME} from "@constants/app";
|
|
import {APP_THEME} from "@constants/app";
|
|
|
-import {useNavigate} from "react-router-dom";
|
|
|
|
|
|
|
+import {useLocation, useNavigate} from "react-router-dom";
|
|
|
import {ROUTE_PATH} from "@constants/routes";
|
|
import {ROUTE_PATH} from "@constants/routes";
|
|
|
import {reqGameInfo} from "@features/api";
|
|
import {reqGameInfo} from "@features/api";
|
|
|
const i18n=global.i18n;
|
|
const i18n=global.i18n;
|
|
@@ -20,6 +20,8 @@ const WSport=({})=>{
|
|
|
const language=i18n.language;
|
|
const language=i18n.language;
|
|
|
const navigate=useNavigate();
|
|
const navigate=useNavigate();
|
|
|
const dispatch=useDispatch();
|
|
const dispatch=useDispatch();
|
|
|
|
|
+ const {pathname} = useLocation();
|
|
|
|
|
+ const [sportPath,setSportPath]=useState("/")
|
|
|
const refreshToken=async ()=>{
|
|
const refreshToken=async ()=>{
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
dispatch(reqGameInfo()).then(({payload})=>{
|
|
dispatch(reqGameInfo()).then(({payload})=>{
|
|
@@ -59,6 +61,7 @@ const WSport=({})=>{
|
|
|
betSlipOffsetRight: 0,
|
|
betSlipOffsetRight: 0,
|
|
|
betSlipOffsetTop: 130,
|
|
betSlipOffsetTop: 130,
|
|
|
betslipZIndex: 100,
|
|
betslipZIndex: 100,
|
|
|
|
|
+ url:sportPath,
|
|
|
onRouteChange: function() {},
|
|
onRouteChange: function() {},
|
|
|
onLogin: function() {
|
|
onLogin: function() {
|
|
|
navigate(ROUTE_PATH.SIGN_IN);
|
|
navigate(ROUTE_PATH.SIGN_IN);
|
|
@@ -80,13 +83,45 @@ const WSport=({})=>{
|
|
|
objInfo.bt=null;
|
|
objInfo.bt=null;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ useEffect(()=>{
|
|
|
|
|
+ if (pathname.startsWith(ROUTE_PATH.SPORTS)){
|
|
|
|
|
+ let sub=pathname.replace(ROUTE_PATH.SPORTS,"");
|
|
|
|
|
+ if (sub==="")sub="/";
|
|
|
|
|
+ setSportPath(sub);
|
|
|
|
|
+ if (objInfo.bt){
|
|
|
|
|
+ objInfo.bt.updateOptions({
|
|
|
|
|
+ url:sub
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },[pathname])
|
|
|
|
|
+ useEffect(()=>{
|
|
|
|
|
+ if (objInfo.bt){
|
|
|
|
|
+ if (bbConf==null)return null;
|
|
|
|
|
+ let bbtheme=bbConf.theme;
|
|
|
|
|
+ let themeIndex=0;
|
|
|
|
|
+ if (theme===APP_THEME.LIGHT)themeIndex=1;
|
|
|
|
|
+ let themeName=bbtheme[themeIndex];
|
|
|
|
|
+ objInfo.bt.updateOptions({
|
|
|
|
|
+ themeName:themeName
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },[theme])
|
|
|
|
|
+ useEffect(()=>{
|
|
|
|
|
+ if (objInfo.bt){
|
|
|
|
|
+ objInfo.bt.updateOptions({
|
|
|
|
|
+ lang: language,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },[language])
|
|
|
useEffect(()=>{
|
|
useEffect(()=>{
|
|
|
clearBT();
|
|
clearBT();
|
|
|
objInfo.bt=initBetby();
|
|
objInfo.bt=initBetby();
|
|
|
return ()=>{
|
|
return ()=>{
|
|
|
clearBT();
|
|
clearBT();
|
|
|
}
|
|
}
|
|
|
- },[userID,theme,language])
|
|
|
|
|
|
|
+ },[userID])
|
|
|
|
|
+ //,theme,language
|
|
|
return (
|
|
return (
|
|
|
<div id="betby" className={`${styles.container} ${isMobile()?styles.container_m:''}`}></div>
|
|
<div id="betby" className={`${styles.container} ${isMobile()?styles.container_m:''}`}></div>
|
|
|
)
|
|
)
|