|
|
@ -6,10 +6,12 @@ import { observer } from 'mobx-react'; |
|
|
|
import { useEffect } from 'react'; |
|
|
|
import store from '~/store'; |
|
|
|
import { initContract } from '~/contract'; |
|
|
|
import { useTranslation } from 'react-i18next'; |
|
|
|
|
|
|
|
const LayoutRouter = () => { |
|
|
|
|
|
|
|
const { location } = useRouter() |
|
|
|
const { location, push } = useRouter() |
|
|
|
const { i18n } = useTranslation() |
|
|
|
const { walletAddress } = store.state |
|
|
|
|
|
|
|
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 ( |
|
|
|
<div className='layout'> |
|
|
|
<Navbar |
|
|
|