|
|
|
@ -34,12 +34,7 @@ export const router = createHashRouter([ |
|
|
|
|
function App(): JSX.Element { |
|
|
|
|
const dispatch = useAppDispatch() |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
dispatch({ |
|
|
|
|
type: 'remixide/connect', |
|
|
|
|
callback: () => { |
|
|
|
|
// @ts-ignore
|
|
|
|
|
remixClient.on('locale', 'localeChanged', (locale: any) => { |
|
|
|
|
const loadRepo = (locale: any) => { |
|
|
|
|
dispatch({ |
|
|
|
|
type: 'remixide/save', |
|
|
|
|
payload: { localeCode: locale.code }, |
|
|
|
@ -48,6 +43,19 @@ function App(): JSX.Element { |
|
|
|
|
type: 'workshop/loadRepo', |
|
|
|
|
payload: repoMap[locale.code] || repoMap.en, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
dispatch({ |
|
|
|
|
type: 'remixide/connect', |
|
|
|
|
callback: () => { |
|
|
|
|
// @ts-ignore
|
|
|
|
|
remixClient.call('locale', 'currentLocale').then((locale: any) => { |
|
|
|
|
loadRepo(locale) |
|
|
|
|
}) |
|
|
|
|
// @ts-ignore
|
|
|
|
|
remixClient.on('locale', 'localeChanged', (locale: any) => { |
|
|
|
|
loadRepo(locale) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|