This commit is contained in:
hamid zarghami
2025-05-18 16:39:10 +03:30
parent 60750d9648
commit c4c0c93599
8 changed files with 75 additions and 64 deletions
+7 -8
View File
@@ -1,8 +1,7 @@
import MainRouter from './router/Main'
import i18next from 'i18next'
import { I18nextProvider } from 'react-i18next'
import { BrowserRouter } from 'react-router-dom'
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
import 'swiper/swiper-bundle.css';
import FaJson from './langs/fa.json'
import { useState } from 'react';
@@ -36,7 +35,7 @@ function App() {
useEffect(() => {
const checkLogin = async () => {
const token = await getToken();
if (token) {
if (token || true) {
setIsLogin('isLogin')
} else {
setIsLogin('isNotLogin')
@@ -121,7 +120,11 @@ function App() {
null
:
isLogin === 'isLogin' ?
<MainRouter />
<Routes>
<Route path="/:slug/*" element={<MainRouter />} />
<Route path="/" element={<Navigate to="/fa/dashboard" replace />} />
<Route path="/auth/*" element={<AuthRouter />} />
</Routes>
:
<AuthRouter />
}
@@ -130,10 +133,6 @@ function App() {
</QueryClientProvider>
</BrowserRouter>
</>
)
}
export default App