diff --git a/.DS_Store b/.DS_Store
index 4c77261..fa219f0 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.env b/.env
index cb1c643..4a9dcd0 100644
--- a/.env
+++ b/.env
@@ -1,4 +1,4 @@
VITE_TOKEN_NAME = 'dzone_token'
VITE_REFRESH_TOKEN_NAME = 'dzone_refresh_token'
-# VITE_BASE_URL = 'https://api.danakcorp.com'
-VITE_BASE_URL = 'http://192.168.1.109:4000'
\ No newline at end of file
+VITE_BASE_URL = 'https://dzone-api.danakcorp.com'
+# VITE_BASE_URL = 'http://192.168.1.109:4000'
\ No newline at end of file
diff --git a/src/App.tsx b/src/App.tsx
index 75edbb5..2db8921 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -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' ?
-
+
+ } />
+ } />
+ } />
+
:
}
@@ -130,10 +133,6 @@ function App() {
>
-
-
-
-
)
}
export default App
diff --git a/src/config/Pages.ts b/src/config/Pages.ts
index 367bba8..a9150ed 100644
--- a/src/config/Pages.ts
+++ b/src/config/Pages.ts
@@ -1,45 +1,45 @@
export const Pages = {
auth: {
- login: "/auth/login",
- register: "/auth/register",
- forgotPassword: "/auth/forgot",
+ login: "auth/login",
+ register: "auth/register",
+ forgotPassword: "auth/forgot",
},
- dashboard: "/dashboard",
+ dashboard: "dashboard",
services: {
- mine: "/services",
- other: "/other-service",
- detail: "/services/detail/",
+ mine: "services",
+ other: "other-service",
+ detail: "services/detail/",
},
- transactions: "/transactions",
+ transactions: "transactions",
receipts: {
- index: "/receipts",
- detail: "/receipts/",
+ index: "receipts",
+ detail: "receipts/",
},
ticket: {
- list: "/tickets",
- create: "/tickets/create",
- detail: "/tickets/messages/",
+ list: "tickets",
+ create: "tickets/create",
+ detail: "tickets/messages/",
},
announcement: {
- list: "/announcement",
- detail: "/announcement/",
+ list: "announcement",
+ detail: "announcement/",
},
company: {
- detail: "/company/detail/",
+ detail: "company/detail/",
},
grade: {
- records: "/grade-records",
+ records: "grade-records",
},
- criticisms: "/criticisms",
- learning: "/learning",
- setting: "/setting",
- wallet: "/wallet",
- profile: "/profile",
- certificate: "/certificate",
- admitCard: "/admitCard",
- myCourses: "/my-courses",
- payment: "/payment",
+ criticisms: "criticisms",
+ learning: "learning",
+ setting: "setting",
+ wallet: "wallet",
+ profile: "profile",
+ certificate: "certificate",
+ admitCard: "admitCard",
+ myCourses: "my-courses",
+ payment: "payment",
reportCard: {
- list: "/report-card/list",
+ list: "report-card/list",
},
};
diff --git a/src/router/Main.tsx b/src/router/Main.tsx
index 7f2b72b..d7d6378 100644
--- a/src/router/Main.tsx
+++ b/src/router/Main.tsx
@@ -2,7 +2,6 @@ import Header from "../shared/Header"
import SideBar from "../shared/SideBar"
import '../assets/fonts/irancell/style.css'
import { Route, Routes } from 'react-router-dom'
-import { Pages } from '../config/Pages'
import Home from '../pages/home/Home'
import ReceiptsList from '../pages/receipts/List'
import AddCriticisms from '../pages/criticisms/Add'
@@ -18,6 +17,7 @@ import ReportCardList from "../pages/ReportCard/List"
import TransactionList from "../pages/transaction/List"
import Profile from "../pages/profile/Profile"
import CompanyDetail from "../pages/company/Detail"
+
const MainRouter = () => {
return (
@@ -27,20 +27,21 @@ const MainRouter = () => {
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
@@ -49,4 +50,5 @@ const MainRouter = () => {
)
}
+
export default MainRouter
\ No newline at end of file
diff --git a/src/shared/Footer.tsx b/src/shared/Footer.tsx
index 16dd1cb..68a710c 100644
--- a/src/shared/Footer.tsx
+++ b/src/shared/Footer.tsx
@@ -2,17 +2,18 @@ import { Buildings, Buildings2, Home2, Messages3, NotificationStatus } from 'ico
import { FC } from 'react'
import { useTranslation } from 'react-i18next'
import { Pages } from '../config/Pages'
-import { Link } from 'react-router-dom'
+import { Link, useParams } from 'react-router-dom'
const Footer: FC = () => {
const { t } = useTranslation('global')
+ const { slug } = useParams()
return (
-
+
@@ -49,7 +50,7 @@ const Footer: FC = () => {
-
+
{
-
+
{
const { t } = useTranslation('global')
const { setOpenSidebar, openSidebar } = useSharedStore()
+ const { slug } = useParams()
return (
@@ -27,13 +28,13 @@ const Header: FC = () => {
{/*

*/}
-
+
-
+
diff --git a/src/shared/SideBarItem.tsx b/src/shared/SideBarItem.tsx
index f4295f1..55363a6 100644
--- a/src/shared/SideBarItem.tsx
+++ b/src/shared/SideBarItem.tsx
@@ -1,5 +1,5 @@
import { FC, ReactNode } from 'react'
-import { Link } from 'react-router-dom'
+import { Link, useParams } from 'react-router-dom'
import { clx } from '../helpers/utils'
import { Pages } from '../config/Pages'
@@ -7,19 +7,27 @@ type Props = {
icon: ReactNode,
title: string,
isActive: boolean,
- link: string,
+ link: string, // مقدار مثل: "dashboard" یا "wallet"
isLogout?: boolean,
}
const SideBarItem: FC
= (props: Props) => {
+ const { slug } = useParams(); // دریافت slug از URL
+ const fullLink = props.isLogout ? Pages.auth.login : `/${slug}/${props.link.replace(/^\//, '')}`;
const handleLogout = () => {
localStorage.removeItem(import.meta.env.VITE_TOKEN_NAME)
window.location.href = Pages.auth.login
}
+ // alert(slug)
+
return (
-
+