|
@ -6,10 +6,12 @@ import { observer } from 'mobx-react'; |
|
|
import { useEffect } from 'react'; |
|
|
import { useEffect } from 'react'; |
|
|
import store from '~/store'; |
|
|
import store from '~/store'; |
|
|
import { initContract } from '~/contract'; |
|
|
import { initContract } from '~/contract'; |
|
|
|
|
|
import { useTranslation } from 'react-i18next'; |
|
|
|
|
|
|
|
|
const LayoutRouter = () => { |
|
|
const LayoutRouter = () => { |
|
|
|
|
|
|
|
|
const { location } = useRouter() |
|
|
|
|
|
|
|
|
const { location, push } = useRouter() |
|
|
|
|
|
const { i18n } = useTranslation() |
|
|
const { walletAddress } = store.state |
|
|
const { walletAddress } = store.state |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
@ -33,9 +35,21 @@ const LayoutRouter = () => { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
initLanguage() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, []) |
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
const initLanguage = () => { |
|
|
|
|
|
let pathname = location.pathname.slice(1) |
|
|
|
|
|
|
|
|
|
|
|
if (pathname === 'zh' || pathname === 'hk' || pathname === 'en') { |
|
|
|
|
|
i18n.changeLanguage(pathname) |
|
|
|
|
|
push('/', null, true) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div className='layout'> |
|
|
<div className='layout'> |
|
|
<Navbar |
|
|
<Navbar |
|
|