Skip to content

Commit

Permalink
chore: with-i18n redirct
Browse files Browse the repository at this point in the history
  • Loading branch information
Daydreamer-riri committed Nov 29, 2024
1 parent 196d55a commit f2e3ef8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/with-i18n/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { RouteRecord } from 'vite-react-ssg'
import './App.css'
import { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import Layout from './Layout'
import { resources } from './i18n'

Expand All @@ -23,6 +25,17 @@ export const routes: RouteRecord[] = [
},
],
},
{
path: '/',
Component: () => {
const navigate = useNavigate()
useEffect(() => {
navigate('/en', { replace: true })
}, [navigate])

return null
},
},
]

async function defaultToComponent(routePromise: Promise<RouteRecord & { default: any }>) {
Expand Down

0 comments on commit f2e3ef8

Please sign in to comment.