From 50078e4cd70bc71b684c5db534eaceaa6ae38266 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 7 Feb 2025 19:41:47 +0530
Subject: [PATCH 1/9] =?UTF-8?q?[=20update=20=F0=9F=91=8D=20]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Pages/ManageContact/ManageContact.tsx | 1 -
src/Pages/ManageContact/PendingRequests.tsx | 166 +++++++------
.../RegisterUsers/RegisterUsers.tsx | 6 +-
src/Pages/SubAdmin/AddModel.tsx | 4 +-
src/Pages/SubAdmin/ViewSubAdmin.tsx | 4 +-
src/components/EditSubAdmin.tsx | 223 ++++++++++++------
6 files changed, 254 insertions(+), 150 deletions(-)
diff --git a/src/Pages/ManageContact/ManageContact.tsx b/src/Pages/ManageContact/ManageContact.tsx
index 1207bf7..07458b7 100644
--- a/src/Pages/ManageContact/ManageContact.tsx
+++ b/src/Pages/ManageContact/ManageContact.tsx
@@ -25,7 +25,6 @@ const managepost: any[] = [
"Action": (
-
),
})),
diff --git a/src/Pages/ManageContact/PendingRequests.tsx b/src/Pages/ManageContact/PendingRequests.tsx
index 23d566b..9356979 100644
--- a/src/Pages/ManageContact/PendingRequests.tsx
+++ b/src/Pages/ManageContact/PendingRequests.tsx
@@ -1,77 +1,105 @@
-import { Button } from "../../components/ui/button"
-import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "../../components/ui/dialog"
-import { Field, HStack, Input, Stack, Textarea, } from "@chakra-ui/react"
+import { Button } from "../../components/ui/button";
+import {
+ DialogBody,
+ DialogCloseTrigger,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogRoot,
+ DialogTitle,
+ DialogTrigger,
+} from "../../components/ui/dialog";
+import { Badge, Field, HStack, Input, Stack, Textarea } from "@chakra-ui/react";
function PendingRequests() {
- return (
+ return (
+
+
+
+ Answer request
+
+
-
-
-
- {/* */}
+
+
+
+ Pending Requests
+
+
-
+
+
+
+
+ Request Type
+
+
-
+ Solution
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- Request Type
-
-
- Solution
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
+
+
+
+ );
}
-export default PendingRequests
\ No newline at end of file
+export default PendingRequests;
diff --git a/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx b/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
index 4bf7247..abfb571 100644
--- a/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
+++ b/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
@@ -1,17 +1,13 @@
import { Box, HStack, Image, Input, Text } from "@chakra-ui/react";
import MainFrame from "../../../components/MainFrame";
import AlertDailog from "../../../components/AlertDailog";
-import { NavLink } from "react-router-dom";
import { RiDeleteBin5Line } from "react-icons/ri";
import DataTable from "../../../components/DataTable";
import { Switch } from "../../../components/ui/switch";
import { InputGroup } from "../../../components/ui/input-group";
import { LuSearch } from "react-icons/lu";
-import { BiEdit } from "react-icons/bi";
import ViewRegisterUsers from "./ViewRegisterUsers";
import EditRegisterUsers from "./EditRegisterUsers";
-import { Button } from "../../../components/ui/button";
-import { IoMdAdd } from "react-icons/io";
import AddRegisterUsers from "./AddRegisterUsers";
const tableHeadRow = [
@@ -74,7 +70,7 @@ const RegisterUsers = () => {
Register Users
-
+
diff --git a/src/Pages/SubAdmin/AddModel.tsx b/src/Pages/SubAdmin/AddModel.tsx
index 403549b..5fab47e 100644
--- a/src/Pages/SubAdmin/AddModel.tsx
+++ b/src/Pages/SubAdmin/AddModel.tsx
@@ -12,7 +12,7 @@ function AddModel() {
{/* */}
-
+
@@ -65,7 +65,7 @@ function AddModel() {
-
diff --git a/src/Pages/SubAdmin/ViewSubAdmin.tsx b/src/Pages/SubAdmin/ViewSubAdmin.tsx
index d3f45b8..83f953f 100644
--- a/src/Pages/SubAdmin/ViewSubAdmin.tsx
+++ b/src/Pages/SubAdmin/ViewSubAdmin.tsx
@@ -67,9 +67,9 @@ function ViewSubAdmin() {
-
+ {/*
Save
-
+ */}
diff --git a/src/components/EditSubAdmin.tsx b/src/components/EditSubAdmin.tsx
index 767022d..9b826a4 100644
--- a/src/components/EditSubAdmin.tsx
+++ b/src/components/EditSubAdmin.tsx
@@ -1,79 +1,160 @@
-import { Button } from "./ui/button"
-import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "./ui/dialog"
-import { Field, Grid, Heading, Input, Stack, Text } from "@chakra-ui/react"
-import { Checkbox } from "./ui/checkbox"
+import { Button } from "./ui/button";
+import {
+ DialogBody,
+ DialogCloseTrigger,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogRoot,
+ DialogTitle,
+ DialogTrigger,
+} from "./ui/dialog";
+import { Field, Grid, Heading, Input, Stack, Text } from "@chakra-ui/react";
+import { Checkbox } from "./ui/checkbox";
import { FaRegEdit } from "react-icons/fa";
function EditSubAdmin() {
- return (
+ return (
+
+
+
+
+
+ {/* */}
+
-
-
-
-
-
- {/* */}
+
+
+
+ Edit Sub Admin Account
+
+
-
+
+
+
+
+ First Name
+
+
+
+ First Name
+
+
+
+ Last Name
+
+
-
-
- Edit Sub Admin Account
-
+
+ DOB
+
+
-
-
-
-
- First Name
-
- First Name
-
- Last Name
-
-
- DOB
-
-
- Gender
-
- Permissions
-
-
-
- Dashboard
- Manage contact us
- manage User
- Manage CMS
- Manage Post
- Manage Reports
- manage Sub-Admin
- My profile
- Manage Jobs
- manage feedbacks
- Manage community
- Notification
-
-
-
-
-
- Save
-
-
-
-
-
-
-
- )
+
+ Gender
+
+
+
+ Permissions
+
+
+
+
+ Dashboard
+
+
+ Manage contact us
+
+
+ manage User
+
+
+ Manage CMS
+
+
+ Manage Post
+
+
+ Manage Reports
+
+
+ manage Sub-Admin
+
+
+ My profile
+
+
+ Manage Jobs{" "}
+
+
+ manage feedbacks
+
+
+ Manage community{" "}
+
+
+ Notification
+
+
+
+
+
+
+ Save
+
+
+
+
+
+ );
}
-export default EditSubAdmin
\ No newline at end of file
+export default EditSubAdmin;
From 9e3918b2eb69ab2f1f35181078425ecc052452cd Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Mon, 10 Feb 2025 12:06:42 +0530
Subject: [PATCH 2/9] [ Insall Redux ]
---
package-lock.json | 57 ++++++++++++++++++++++++++++++++++++++++++++++-
package.json | 1 +
2 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/package-lock.json b/package-lock.json
index f18c84e..e686bae 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"@chakra-ui/react": "^3.2.3",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
+ "@reduxjs/toolkit": "^2.5.1",
"chart.js": "^4.4.7",
"framer-motion": "^11.18.0",
"next-themes": "^0.4.4",
@@ -1670,7 +1671,6 @@
},
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
"version": "1.3.0",
- "extraneous": true,
"inBundle": true,
"license": "MIT",
"engines": {
@@ -2722,6 +2722,30 @@
"node": ">=14"
}
},
+ "node_modules/@reduxjs/toolkit": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.5.1.tgz",
+ "integrity": "sha512-UHhy3p0oUpdhnSxyDjaRDYaw8Xra75UiLbCiRozVPHjfDwNYkh0TsVm/1OmTW8Md+iDAJmYPWUKMvsMc2GtpNg==",
+ "license": "MIT",
+ "dependencies": {
+ "immer": "^10.0.3",
+ "redux": "^5.0.1",
+ "redux-thunk": "^3.1.0",
+ "reselect": "^5.1.0"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
+ "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
+ },
+ "peerDependenciesMeta": {
+ "react": {
+ "optional": true
+ },
+ "react-redux": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@rollup/plugin-babel": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz",
@@ -6710,6 +6734,16 @@
"node": ">= 4"
}
},
+ "node_modules/immer": {
+ "version": "10.1.1",
+ "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz",
+ "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/immer"
+ }
+ },
"node_modules/import-fresh": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
@@ -8198,6 +8232,21 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/redux": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
+ "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
+ "license": "MIT"
+ },
+ "node_modules/redux-thunk": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
+ "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
+ "license": "MIT",
+ "peerDependencies": {
+ "redux": "^5.0.0"
+ }
+ },
"node_modules/reflect.getprototypeof": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz",
@@ -8329,6 +8378,12 @@
"node": ">=0.10.0"
}
},
+ "node_modules/reselect": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
+ "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==",
+ "license": "MIT"
+ },
"node_modules/resolve": {
"version": "1.22.10",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
diff --git a/package.json b/package.json
index ca92e73..bc49935 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"@chakra-ui/react": "^3.2.3",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
+ "@reduxjs/toolkit": "^2.5.1",
"chart.js": "^4.4.7",
"framer-motion": "^11.18.0",
"next-themes": "^0.4.4",
From f7e76c8fc0ceeb6f8dd5e5fb2ab9b80a93a8d7e0 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Mon, 10 Feb 2025 12:30:06 +0530
Subject: [PATCH 3/9] [ working ... ]
---
package-lock.json | 62 ++---------------
src/Pages/Login.tsx | 166 +++++++++++++++++++++++++++-----------------
2 files changed, 109 insertions(+), 119 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 1d95b8a..9005efe 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1922,7 +1922,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1939,7 +1938,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1956,7 +1954,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1973,7 +1970,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1990,7 +1986,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2007,7 +2002,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2024,7 +2018,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2041,7 +2034,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2058,7 +2050,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2075,7 +2066,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2092,7 +2082,6 @@
"cpu": [
"ia32"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2109,7 +2098,6 @@
"cpu": [
"loong64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2126,7 +2114,6 @@
"cpu": [
"mips64el"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2143,7 +2130,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2160,7 +2146,6 @@
"cpu": [
"riscv64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2177,7 +2162,6 @@
"cpu": [
"s390x"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2194,7 +2178,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2211,7 +2194,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2228,7 +2210,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2245,7 +2226,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2262,7 +2242,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2279,7 +2258,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2296,7 +2274,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2313,7 +2290,6 @@
"cpu": [
"ia32"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2330,7 +2306,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2925,7 +2900,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2939,7 +2913,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2953,7 +2926,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2967,7 +2939,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2981,7 +2952,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2995,7 +2965,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3009,7 +2978,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3023,7 +2991,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3037,7 +3004,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3051,7 +3017,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3065,7 +3030,6 @@
"cpu": [
"loong64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3079,7 +3043,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3093,7 +3056,6 @@
"cpu": [
"riscv64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3107,7 +3069,6 @@
"cpu": [
"s390x"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3121,7 +3082,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3135,7 +3095,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3149,7 +3108,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3163,7 +3121,6 @@
"cpu": [
"ia32"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3177,7 +3134,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3222,7 +3178,7 @@
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
"integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.20.7",
@@ -3236,7 +3192,7 @@
"version": "7.6.8",
"resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz",
"integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@babel/types": "^7.0.0"
@@ -3246,7 +3202,7 @@
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
"integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.1.0",
@@ -3257,7 +3213,7 @@
"version": "7.20.6",
"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz",
"integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@babel/types": "^7.20.7"
@@ -3316,14 +3272,14 @@
"version": "15.7.14",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz",
"integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==",
- "dev": true,
+ "devOptional": true,
"license": "MIT"
},
"node_modules/@types/react": {
"version": "18.3.18",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.18.tgz",
"integrity": "sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@types/prop-types": "*",
@@ -5857,7 +5813,6 @@
"version": "0.24.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz",
"integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==",
- "dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
@@ -7735,7 +7690,6 @@
"version": "3.3.8",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
- "dev": true,
"funding": [
{
"type": "github",
@@ -8121,7 +8075,6 @@
"version": "8.4.49",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
"integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
- "dev": true,
"funding": [
{
"type": "opencollective",
@@ -8945,7 +8898,6 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
- "dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@@ -9707,7 +9659,6 @@
"version": "6.0.6",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.0.6.tgz",
"integrity": "sha512-NSjmUuckPmDU18bHz7QZ+bTYhRR0iA72cs2QAxCqDpafJ0S6qetco0LB3WW2OxlMHS0JmAv+yZ/R3uPmMyGTjQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "^0.24.2",
@@ -9809,7 +9760,6 @@
"version": "4.34.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.1.tgz",
"integrity": "sha512-iYZ/+PcdLYSGfH3S+dGahlW/RWmsqDhLgj1BT9DH/xXJ0ggZN7xkdP9wipPNjjNLczI+fmMLmTB9pye+d2r4GQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "1.0.6"
diff --git a/src/Pages/Login.tsx b/src/Pages/Login.tsx
index d71bcfe..daf9af5 100644
--- a/src/Pages/Login.tsx
+++ b/src/Pages/Login.tsx
@@ -1,107 +1,147 @@
-import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react"
-import axios from "axios"
-import { useContext, useState } from "react"
-import { useForm } from "react-hook-form"
-import { useDispatch } from "react-redux"
-import GlobalStateContext from "../Contexts/GlobalStateContext"
-import { setToken } from "../Redux/Service/authSlice"
-import logo from '../assets/logo.svg'
-import { Button } from "../components/ui/button"
-import { Field } from "../components/ui/field"
-import { Toaster } from "../components/ui/toaster"
+import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react";
+import axios from "axios";
+import { useContext, useState } from "react";
+import { useForm } from "react-hook-form";
+import { useDispatch } from "react-redux";
+import GlobalStateContext from "../Contexts/GlobalStateContext";
+import { setToken } from "../Redux/Service/authSlice";
+import logo from "../assets/logo.svg";
+import { Button } from "../components/ui/button";
+import { Field } from "../components/ui/field";
+import { Toaster } from "../components/ui/toaster";
interface FormValues {
- mobileNumber: number
- password: string
+ mobileNumber: number;
+ password: string;
}
const Login = () => {
- const dispatch = useDispatch()
- const [isLoading, setIsLoading] = useState(false)
+ const dispatch = useDispatch();
+ const [isLoading, setIsLoading] = useState(false);
const context = useContext(GlobalStateContext);
if (!context) {
- throw new Error('App must be used within a GlobalStateProvider');
+ throw new Error("App must be used within a GlobalStateProvider");
}
const { setIsAuthenticate } = context;
const {
register,
handleSubmit,
formState: { errors },
- } = useForm()
-
+ } = useForm();
const onSubmit = handleSubmit(async (data) => {
- setIsLoading(true)
+ setIsLoading(true);
try {
- const response = await axios.post(`${import.meta.env.VITE_API_URL}/v1/login`, {
- mobile_number: data.mobileNumber,
- password: data.password,
- });
- console.log('====================================');
+ const response = await axios.post(
+ `${import.meta.env.VITE_API_URL}/v1/login`,
+ {
+ mobile_number: data.mobileNumber,
+ password: data.password,
+ }
+ );
+ console.log("====================================");
console.log(response);
- console.log('====================================');
+ console.log("====================================");
dispatch(setToken(String(response.data["access-token"])));
-
} catch (error) {
console.error("Login failed", error);
}
});
-
-
-
-
return (
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+ LOGIN
+
-
-
-
-
-
- LOGIN
-
-
-
-
+
+
+
{/* Forget password */}
-
-
+
+
{/* Forget password */}
- Login
+
+ Login
+
Forgot password
-
-
- )
-}
+ );
+};
-export default Login
\ No newline at end of file
+export default Login;
From 3aa93b358fd288a36644167b24c6341ff8f273ec Mon Sep 17 00:00:00 2001
From: "Siddhesh.More"
Date: Mon, 10 Feb 2025 19:10:04 +0530
Subject: [PATCH 4/9] update
---
.env | 3 ++-
dev-dist/sw.js | 2 +-
package-lock.json | 18 +++++++++++++++++
package.json | 2 ++
src/App.tsx | 12 +++++------
src/Pages/Login.tsx | 36 +++++++++++++++++++++++----------
src/Redux/Service/authSlice.tsx | 7 ++++---
vite.config.ts | 2 +-
8 files changed, 59 insertions(+), 23 deletions(-)
diff --git a/.env b/.env
index 90e2eef..b24b765 100644
--- a/.env
+++ b/.env
@@ -1,4 +1,5 @@
-VITE_API_URL=https://ssa.betadelivery.com/apia/v1
+VITE_API_URL='https://ssa.betadelivery.com/apia/v1'
+# VITE_API_URL='http://192.16.50.44/seo-backend/apia/v1'
VITE_USER_NAME="Admin"
VITE_PASSWORD="71%@L%es^bUX94`J9XT*%4&^%tUU^%Q^ffgt"
VITE_APP_NAME=MyViteApp
\ No newline at end of file
diff --git a/dev-dist/sw.js b/dev-dist/sw.js
index 9c5feb8..acea9fc 100644
--- a/dev-dist/sw.js
+++ b/dev-dist/sw.js
@@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
- "revision": "0.tg13lftuk78"
+ "revision": "0.i87c5gdh6n"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
diff --git a/package-lock.json b/package-lock.json
index 1d95b8a..71d1d89 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,6 +15,7 @@
"axios": "^1.7.9",
"chart.js": "^4.4.7",
"framer-motion": "^11.18.0",
+ "js-cookie": "^3.0.5",
"next-themes": "^0.4.4",
"react": "^18.3.1",
"react-chartjs-2": "^5.3.0",
@@ -28,6 +29,7 @@
"devDependencies": {
"@chakra-ui/cli": "^3.2.3",
"@eslint/js": "^9.17.0",
+ "@types/js-cookie": "^3.0.6",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
@@ -3292,6 +3294,13 @@
"integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
"license": "MIT"
},
+ "node_modules/@types/js-cookie": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-3.0.6.tgz",
+ "integrity": "sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@@ -7394,6 +7403,15 @@
"node": ">=10"
}
},
+ "node_modules/js-cookie": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz",
+ "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
diff --git a/package.json b/package.json
index aef7be3..af0444f 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
"axios": "^1.7.9",
"chart.js": "^4.4.7",
"framer-motion": "^11.18.0",
+ "js-cookie": "^3.0.5",
"next-themes": "^0.4.4",
"react": "^18.3.1",
"react-chartjs-2": "^5.3.0",
@@ -30,6 +31,7 @@
"devDependencies": {
"@chakra-ui/cli": "^3.2.3",
"@eslint/js": "^9.17.0",
+ "@types/js-cookie": "^3.0.6",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
diff --git a/src/App.tsx b/src/App.tsx
index fa6affb..2b7873a 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,20 +1,20 @@
-import { useContext } from 'react';
import { Route, BrowserRouter as Router, Routes } from "react-router-dom";
-import GlobalStateContext from './Contexts/GlobalStateContext';
import DefaultLayout from './Layouts/DefaultLayout';
import Login from './Pages/Login';
import { RouteLink } from './Routes/Routes';
+import Cookies from "js-cookie";
function App() {
- const context = useContext(GlobalStateContext);
- if (!context) throw new Error('App must be used within a GlobalStateProvider');
- const { isAuthenticate } = context;
+ // const context = useContext(GlobalStateContext);
+ // if (!context) throw new Error('App must be used within a GlobalStateProvider');
+ // const { isAuthenticate } = context;
+ const token = Cookies.get("token")
return (
} />
- {RouteLink.map(({ path, Component }, index) => (} />))}) : ()} />
+ {RouteLink.map(({ path, Component }, index) => (} />))}) : ()} />
} />
diff --git a/src/Pages/Login.tsx b/src/Pages/Login.tsx
index b8d4a68..a892ba1 100644
--- a/src/Pages/Login.tsx
+++ b/src/Pages/Login.tsx
@@ -9,6 +9,8 @@ import logo from '../assets/logo.svg'
import { Button } from "../components/ui/button"
import { Field } from "../components/ui/field"
import { Toaster } from "../components/ui/toaster"
+import { PasswordInput } from "../components/ui/password-input"
+import { useNavigate } from "react-router-dom"
interface FormValues {
mobileNumber: number
@@ -16,6 +18,7 @@ interface FormValues {
}
const Login = () => {
+ const navigate = useNavigate()
const dispatch = useDispatch()
const [isLoading, setIsLoading] = useState(false)
const context = useContext(GlobalStateContext);
@@ -35,13 +38,13 @@ const Login = () => {
// Encode Basic Auth Credentials
const username = import.meta.env.VITE_USER_NAME||''; // Replace with actual username
const password = import.meta.env.VITE_PASSWORD||''; // Replace with actual password
- const basicAuth = btoa(`${username}:${password}`); // Encode to Base64
+ const basicAuth = `${username} : ${password}`; // Encode to Base64
try {
- const response = await axios.post(
- `${import.meta.env.VITE_API_URL}/v1/login`,
+ const res = await axios.post(
+ `${import.meta.env.VITE_API_URL}/login`,
{
- mobile_number: data.mobileNumber,
+ mobile_number: Number(data.mobileNumber),
password: data.password,
},
{
@@ -51,11 +54,22 @@ const Login = () => {
},
}
);
+
+ if (res.data) {
+ setIsAuthenticate(true)
+ console.log('====================================');
+ console.log(res.data?.data);
+ console.log('====================================');
+ navigate('/')
+ dispatch(setToken(String(res.data?.data["access-token"])));
+ } else {
+
+ console.log("====================================");
+ console.log(res);
+ console.log("====================================");
+
+ }
- console.log("====================================");
- console.log(response);
- console.log("====================================");
- dispatch(setToken(String(response.data["access-token"])));
} catch (error) {
if (error) {
@@ -101,11 +115,11 @@ const Login = () => {
-
+
{/* Forget password */}
-
-
+
+
{/* Forget password */}
Login
diff --git a/src/Redux/Service/authSlice.tsx b/src/Redux/Service/authSlice.tsx
index f94a531..38ad1c4 100644
--- a/src/Redux/Service/authSlice.tsx
+++ b/src/Redux/Service/authSlice.tsx
@@ -1,11 +1,12 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
+import Cookies from "js-cookie";
type AuthState = {
token: string | null;
};
const initialState: AuthState = {
- token: localStorage.getItem("token"), // Load token from localStorage
+ token: Cookies.get("token") || null, // Load token from cookies
};
const authSlice = createSlice({
@@ -14,11 +15,11 @@ const authSlice = createSlice({
reducers: {
setToken: (state, action: PayloadAction) => {
state.token = action.payload;
- localStorage.setItem("token", action.payload);
+ Cookies.set("token", action.payload, { expires: 7, secure: true, sameSite: "Strict" }); // Store in cookies for 7 days
},
logout: (state) => {
state.token = null;
- localStorage.removeItem("token");
+ Cookies.remove("token");
},
},
});
diff --git a/vite.config.ts b/vite.config.ts
index 71b3004..8377a40 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -6,7 +6,7 @@ import { VitePWA } from "vite-plugin-pwa";
export default defineConfig({
server: {
host: "0.0.0.0",
- port: 3001, // You can use any port
+ port: 3000, // You can use any port
},
plugins: [
react(),
From 18c9ff8b789d68dceb5600c42f1c0c906115615c Mon Sep 17 00:00:00 2001
From: "Siddhesh.More"
Date: Mon, 10 Feb 2025 19:34:29 +0530
Subject: [PATCH 5/9] update
---
src/Redux/Service/apiSlice.tsx | 19 ++++++++--
.../Service/deactivated.account.service.ts | 26 +++++++++++++
src/Redux/Service/faqs.service.ts | 26 +++++++++++++
src/Redux/Service/manage.aboutus.service.ts | 26 +++++++++++++
src/Redux/Service/manage.contactus.service.ts | 26 +++++++++++++
src/Redux/Service/manage.groups.service.ts | 26 +++++++++++++
src/Redux/Service/manage.jobs.service.ts | 26 +++++++++++++
src/Redux/Service/manage.posts.service.ts | 26 +++++++++++++
src/Redux/Service/manage.subadmin.service.ts | 26 +++++++++++++
src/Redux/Service/master.module.service.ts | 26 +++++++++++++
src/Redux/Service/myprofie.service.ts | 26 +++++++++++++
src/Redux/Service/privacy.policy.service.ts | 26 +++++++++++++
src/Redux/Service/privacy.service.ts | 26 +++++++++++++
src/Redux/Service/register.user.service.ts | 26 +++++++++++++
.../Service/terms.and.condition.service.ts | 26 +++++++++++++
src/Redux/Store.tsx | 37 +++++++++++++++++--
16 files changed, 412 insertions(+), 8 deletions(-)
create mode 100644 src/Redux/Service/deactivated.account.service.ts
create mode 100644 src/Redux/Service/faqs.service.ts
create mode 100644 src/Redux/Service/manage.aboutus.service.ts
create mode 100644 src/Redux/Service/manage.contactus.service.ts
create mode 100644 src/Redux/Service/manage.groups.service.ts
create mode 100644 src/Redux/Service/manage.jobs.service.ts
create mode 100644 src/Redux/Service/manage.posts.service.ts
create mode 100644 src/Redux/Service/manage.subadmin.service.ts
create mode 100644 src/Redux/Service/master.module.service.ts
create mode 100644 src/Redux/Service/myprofie.service.ts
create mode 100644 src/Redux/Service/privacy.policy.service.ts
create mode 100644 src/Redux/Service/privacy.service.ts
create mode 100644 src/Redux/Service/register.user.service.ts
create mode 100644 src/Redux/Service/terms.and.condition.service.ts
diff --git a/src/Redux/Service/apiSlice.tsx b/src/Redux/Service/apiSlice.tsx
index cc8ae3a..46513e4 100644
--- a/src/Redux/Service/apiSlice.tsx
+++ b/src/Redux/Service/apiSlice.tsx
@@ -6,9 +6,17 @@ import { RootState } from "../Store";
const baseQuery = fetchBaseQuery({
baseUrl: `${import.meta.env.VITE_API_URL}`,
prepareHeaders: (headers, { getState }) => {
+
const token = (getState() as RootState).auth.token; // Get token from Redux store
+ // Encode Basic Auth Credentials
+ const username = import.meta.env.VITE_USER_NAME||''; // Replace with actual username
+ const password = import.meta.env.VITE_PASSWORD||''; // Replace with actual password
+ const basicAuth = `${username} : ${password}`; // Encode to Base64
+
if (token) {
- headers.set("Authorization", `Bearer ${token}`);
+ headers.set("Authorization", `Basic ${basicAuth}`);
+ headers.set("access-token", `Bearer ${token}`);
+
}
headers.set("Content-Type", "application/json");
return headers;
@@ -16,7 +24,7 @@ const baseQuery = fetchBaseQuery({
});
// ✅ Handle 401 Errors (Auto Logout)
-const baseQueryWithReauth: BaseQueryFn<
+export const baseQueryWithReauth: BaseQueryFn<
string | FetchArgs,
unknown,
FetchBaseQueryError
@@ -30,7 +38,10 @@ const baseQueryWithReauth: BaseQueryFn<
return result;
};
-export const apiSlice = createApi({
+
+
+
+export const dashboard = createApi({
reducerPath: "api",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -46,7 +57,7 @@ export const apiSlice = createApi({
}),
});
-export const { useGetPostsQuery } = apiSlice;
+export const { useGetPostsQuery } = dashboard;
export type Post = {
id: number;
diff --git a/src/Redux/Service/deactivated.account.service.ts b/src/Redux/Service/deactivated.account.service.ts
new file mode 100644
index 0000000..13b720a
--- /dev/null
+++ b/src/Redux/Service/deactivated.account.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const deactivatedAccounts = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = deactivatedAccounts;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/faqs.service.ts b/src/Redux/Service/faqs.service.ts
new file mode 100644
index 0000000..78dd3f7
--- /dev/null
+++ b/src/Redux/Service/faqs.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const faqs = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = faqs;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/manage.aboutus.service.ts b/src/Redux/Service/manage.aboutus.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/manage.aboutus.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/manage.contactus.service.ts b/src/Redux/Service/manage.contactus.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/manage.contactus.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/manage.groups.service.ts b/src/Redux/Service/manage.groups.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/manage.groups.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/manage.jobs.service.ts b/src/Redux/Service/manage.jobs.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/manage.jobs.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/manage.posts.service.ts b/src/Redux/Service/manage.posts.service.ts
new file mode 100644
index 0000000..a7b4a46
--- /dev/null
+++ b/src/Redux/Service/manage.posts.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const managePosts = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = managePosts;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/manage.subadmin.service.ts b/src/Redux/Service/manage.subadmin.service.ts
new file mode 100644
index 0000000..6b08cf8
--- /dev/null
+++ b/src/Redux/Service/manage.subadmin.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const manageSubAdmin = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = manageSubAdmin;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/master.module.service.ts b/src/Redux/Service/master.module.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/master.module.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/myprofie.service.ts b/src/Redux/Service/myprofie.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/myprofie.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/privacy.policy.service.ts b/src/Redux/Service/privacy.policy.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/privacy.policy.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/privacy.service.ts b/src/Redux/Service/privacy.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/privacy.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/register.user.service.ts b/src/Redux/Service/register.user.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/register.user.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Service/terms.and.condition.service.ts b/src/Redux/Service/terms.and.condition.service.ts
new file mode 100644
index 0000000..ccad2a2
--- /dev/null
+++ b/src/Redux/Service/terms.and.condition.service.ts
@@ -0,0 +1,26 @@
+import { createApi } from "@reduxjs/toolkit/query";
+import { baseQueryWithReauth } from "./apiSlice";
+
+export const registerUser = createApi({
+ reducerPath: "api",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ getPosts: builder.query({ query: () => "/posts" }),
+
+
+
+
+
+ }),
+ });
+
+ export const { } = registerUser;
+
+ export type Post = {
+ id: number;
+ title: string;
+ body: string;
+ };
\ No newline at end of file
diff --git a/src/Redux/Store.tsx b/src/Redux/Store.tsx
index f2d8548..5d4218b 100644
--- a/src/Redux/Store.tsx
+++ b/src/Redux/Store.tsx
@@ -1,14 +1,43 @@
import { configureStore } from "@reduxjs/toolkit";
-import { apiSlice } from "./Service/apiSlice";
-import authReducer from "./Service/authSlice"
+import { dashboard } from "./Service/apiSlice";
+import authReducer from "./Service/authSlice";
+import { registerUser } from "./Service/register.user.service";
+import { deactivatedAccounts } from "./Service/deactivated.account.service";
+import { faqs } from "./Service/faqs.service";
+import { managePosts } from "./Service/manage.posts.service";
+import { manageSubAdmin } from "./Service/manage.subadmin.service";
export const store = configureStore({
reducer: {
- [apiSlice.reducerPath]: apiSlice.reducer,
+ [dashboard.reducerPath]: dashboard.reducer,
+ [registerUser.reducerPath]: registerUser.reducer,
+ [deactivatedAccounts.reducerPath]: deactivatedAccounts.reducer,
+ [faqs.reducerPath]: faqs.reducer,
+ [managePosts.reducerPath]: managePosts.reducer,
+ [manageSubAdmin.reducerPath]: manageSubAdmin.reducer,
+
+
+
+
+
+
+ [registerUser.reducerPath]: registerUser.reducer,
+ [registerUser.reducerPath]: registerUser.reducer,
+ [registerUser.reducerPath]: registerUser.reducer,
+ [registerUser.reducerPath]: registerUser.reducer,
+ [registerUser.reducerPath]: registerUser.reducer,
+ [registerUser.reducerPath]: registerUser.reducer,
auth: authReducer,
},
middleware: (getDefaultMiddleware) =>
- getDefaultMiddleware().concat(apiSlice.middleware),
+ getDefaultMiddleware().concat(
+ dashboard.middleware,
+ registerUser.middleware,
+ deactivatedAccounts.middleware,
+ managePosts.middleware,
+ faqs.middleware,
+ manageSubAdmin.middleware,
+ ),
});
export type RootState = ReturnType;
From 4fa87e01b6302cc561203f61abb88dbe3a000aea Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Mon, 10 Feb 2025 19:36:14 +0530
Subject: [PATCH 6/9] [ service ]
---
src/Pages/Login.tsx | 197 ++++++++++++++++----------------------------
src/main.tsx | 34 ++++----
2 files changed, 90 insertions(+), 141 deletions(-)
diff --git a/src/Pages/Login.tsx b/src/Pages/Login.tsx
index 8670ecf..9db1596 100644
--- a/src/Pages/Login.tsx
+++ b/src/Pages/Login.tsx
@@ -1,45 +1,45 @@
-import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react";
-import axios from "axios";
-import { useContext, useState } from "react";
-import { useForm } from "react-hook-form";
-import { useDispatch } from "react-redux";
-import GlobalStateContext from "../Contexts/GlobalStateContext";
-import { setToken } from "../Redux/Service/authSlice";
-import logo from "../assets/logo.svg";
-import { Button } from "../components/ui/button";
-import { Field } from "../components/ui/field";
-import { Toaster } from "../components/ui/toaster";
-import { PasswordInput } from "../components/ui/password-input";
-import { useNavigate } from "react-router-dom";
+import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react"
+import axios from "axios"
+import { useContext, useState } from "react"
+import { useForm } from "react-hook-form"
+import { useDispatch } from "react-redux"
+import GlobalStateContext from "../Contexts/GlobalStateContext"
+import { setToken } from "../Redux/Service/authSlice"
+import logo from '../assets/logo.svg'
+import { Button } from "../components/ui/button"
+import { Field } from "../components/ui/field"
+import { Toaster } from "../components/ui/toaster"
+import { PasswordInput } from "../components/ui/password-input"
+import { useNavigate } from "react-router-dom"
interface FormValues {
- mobileNumber: number;
- password: string;
+ mobileNumber: number
+ password: string
}
const Login = () => {
- const navigate = useNavigate();
- const dispatch = useDispatch();
- const [isLoading, setIsLoading] = useState(false);
+ const navigate = useNavigate()
+ const dispatch = useDispatch()
+ const [isLoading, setIsLoading] = useState(false)
const context = useContext(GlobalStateContext);
if (!context) {
- throw new Error("App must be used within a GlobalStateProvider");
+ throw new Error('App must be used within a GlobalStateProvider');
}
const { setIsAuthenticate } = context;
const {
register,
handleSubmit,
formState: { errors },
- } = useForm();
+ } = useForm()
const onSubmit = handleSubmit(async (data) => {
setIsLoading(true);
-
+
// Encode Basic Auth Credentials
- const username = import.meta.env.VITE_USER_NAME || ""; // Replace with actual username
- const password = import.meta.env.VITE_PASSWORD || ""; // Replace with actual password
+ const username = import.meta.env.VITE_USER_NAME||''; // Replace with actual username
+ const password = import.meta.env.VITE_PASSWORD||''; // Replace with actual password
const basicAuth = `${username} : ${password}`; // Encode to Base64
-
+
try {
const res = await axios.post(
`${import.meta.env.VITE_API_URL}/login`,
@@ -56,139 +56,84 @@ const Login = () => {
);
if (res.data) {
- setIsAuthenticate(true);
- console.log("====================================");
+ setIsAuthenticate(true)
+ console.log('====================================');
console.log(res.data?.data);
- console.log("====================================");
- navigate("/");
+ console.log('====================================');
+ navigate('/')
dispatch(setToken(String(res.data?.data["access-token"])));
} else {
+
console.log("====================================");
console.log(res);
console.log("====================================");
+
}
+
} catch (error) {
if (error) {
+
console.error("Login failed", error);
- setIsLoading(false);
+ setIsLoading(false)
+
}
}
});
+
+
+
return (
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
- LOGIN
-
-
-
-
-
-
- LOGIN
-
-
-
-
- {/* Forget password */}
+
+
+
+
+ LOGIN
+
+
+
+
+ {/* Forget password */}
-
-
- {/* Forget password */}
+
+
+ {/* Forget password */}
-
- Login
-
+ Login
Forgot password
+
+
- );
-};
+ )
+}
-export default Login;
+export default Login
\ No newline at end of file
diff --git a/src/main.tsx b/src/main.tsx
index 5bc746e..c983e7f 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,23 +1,27 @@
-import React from 'react'
-import ReactDOM from 'react-dom/client'
-import App from './App'
+import React from "react";
+import ReactDOM from "react-dom/client";
+import App from "./App";
import { Provider as ReduxProvider } from "react-redux";
-import { Provider } from './components/ui/provider'
-import GlobalStateProvider from './Contexts/GlobalStateProvider'
-import './index.css'
-import { Theme } from '@chakra-ui/react'
-import { store } from './Redux/Store'
+import { Provider } from "./components/ui/provider";
+import GlobalStateProvider from "./Contexts/GlobalStateProvider";
+import "./index.css";
+import { Theme } from "@chakra-ui/react";
+import { store } from "./Redux/Store";
-ReactDOM.createRoot(document.getElementById('root')!).render(
-
- {/* ✅ Wrap with Redux Provider */}
+ReactDOM.createRoot(document.getElementById("root")!).render(
+
+
+ {" "}
+ {/* ✅ Wrap with Redux Provider */}
- {/* ✅ Wrap with Provider */}
-
-
+
+ {" "}
+ {/* ✅ Wrap with Provider */}
+
+
-)
\ No newline at end of file
+);
From 0d34e1bae7e8b75387f211a034116fbbcf0b2102 Mon Sep 17 00:00:00 2001
From: "Siddhesh.More"
Date: Mon, 10 Feb 2025 19:54:18 +0530
Subject: [PATCH 7/9] UPDAATE
---
.../Service/deactivated.account.service.ts | 2 +-
src/Redux/Service/faqs.service.ts | 2 +-
src/Redux/Service/manage.aboutus.service.ts | 6 +--
src/Redux/Service/manage.contactus.service.ts | 6 +--
src/Redux/Service/manage.groups.service.ts | 6 +--
src/Redux/Service/manage.jobs.service.ts | 6 +--
src/Redux/Service/manage.posts.service.ts | 2 +-
src/Redux/Service/manage.subadmin.service.ts | 2 +-
src/Redux/Service/master.module.service.ts | 6 +--
src/Redux/Service/myprofie.service.ts | 6 +--
src/Redux/Service/privacy.policy.service.ts | 6 +--
src/Redux/Service/privacy.service.ts | 6 +--
src/Redux/Service/register.user.service.ts | 2 +-
.../Service/terms.and.condition.service.ts | 4 +-
src/Redux/Store.tsx | 37 ++++++++++++-------
15 files changed, 55 insertions(+), 44 deletions(-)
diff --git a/src/Redux/Service/deactivated.account.service.ts b/src/Redux/Service/deactivated.account.service.ts
index 13b720a..da76c97 100644
--- a/src/Redux/Service/deactivated.account.service.ts
+++ b/src/Redux/Service/deactivated.account.service.ts
@@ -2,7 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
export const deactivatedAccounts = createApi({
- reducerPath: "api",
+ reducerPath: "deactivatedAccounts",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
diff --git a/src/Redux/Service/faqs.service.ts b/src/Redux/Service/faqs.service.ts
index 78dd3f7..d232234 100644
--- a/src/Redux/Service/faqs.service.ts
+++ b/src/Redux/Service/faqs.service.ts
@@ -2,7 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
export const faqs = createApi({
- reducerPath: "api",
+ reducerPath: "faqs",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
diff --git a/src/Redux/Service/manage.aboutus.service.ts b/src/Redux/Service/manage.aboutus.service.ts
index ccad2a2..bda6a51 100644
--- a/src/Redux/Service/manage.aboutus.service.ts
+++ b/src/Redux/Service/manage.aboutus.service.ts
@@ -1,8 +1,8 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
- reducerPath: "api",
+export const aboutUs = createApi({
+ reducerPath: "aboutUs",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = aboutUs;
export type Post = {
id: number;
diff --git a/src/Redux/Service/manage.contactus.service.ts b/src/Redux/Service/manage.contactus.service.ts
index ccad2a2..20b3890 100644
--- a/src/Redux/Service/manage.contactus.service.ts
+++ b/src/Redux/Service/manage.contactus.service.ts
@@ -1,8 +1,8 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
- reducerPath: "api",
+export const manageContactUs = createApi({
+ reducerPath: "manageContactUs",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = manageContactUs;
export type Post = {
id: number;
diff --git a/src/Redux/Service/manage.groups.service.ts b/src/Redux/Service/manage.groups.service.ts
index ccad2a2..32df1aa 100644
--- a/src/Redux/Service/manage.groups.service.ts
+++ b/src/Redux/Service/manage.groups.service.ts
@@ -1,8 +1,8 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
- reducerPath: "api",
+export const manageGroups = createApi({
+ reducerPath: "manageGroups",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = manageGroups;
export type Post = {
id: number;
diff --git a/src/Redux/Service/manage.jobs.service.ts b/src/Redux/Service/manage.jobs.service.ts
index ccad2a2..c5face7 100644
--- a/src/Redux/Service/manage.jobs.service.ts
+++ b/src/Redux/Service/manage.jobs.service.ts
@@ -1,8 +1,8 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
- reducerPath: "api",
+export const manageJobs = createApi({
+ reducerPath: "manageJobs",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = manageJobs;
export type Post = {
id: number;
diff --git a/src/Redux/Service/manage.posts.service.ts b/src/Redux/Service/manage.posts.service.ts
index a7b4a46..d51e7ab 100644
--- a/src/Redux/Service/manage.posts.service.ts
+++ b/src/Redux/Service/manage.posts.service.ts
@@ -2,7 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
export const managePosts = createApi({
- reducerPath: "api",
+ reducerPath: "managePosts",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
diff --git a/src/Redux/Service/manage.subadmin.service.ts b/src/Redux/Service/manage.subadmin.service.ts
index 6b08cf8..1bc39c7 100644
--- a/src/Redux/Service/manage.subadmin.service.ts
+++ b/src/Redux/Service/manage.subadmin.service.ts
@@ -2,7 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
export const manageSubAdmin = createApi({
- reducerPath: "api",
+ reducerPath: "manageSubAdmin",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
diff --git a/src/Redux/Service/master.module.service.ts b/src/Redux/Service/master.module.service.ts
index ccad2a2..d709379 100644
--- a/src/Redux/Service/master.module.service.ts
+++ b/src/Redux/Service/master.module.service.ts
@@ -1,8 +1,8 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
- reducerPath: "api",
+export const masterModule = createApi({
+ reducerPath: "masterModule",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = masterModule;
export type Post = {
id: number;
diff --git a/src/Redux/Service/myprofie.service.ts b/src/Redux/Service/myprofie.service.ts
index ccad2a2..05748fb 100644
--- a/src/Redux/Service/myprofie.service.ts
+++ b/src/Redux/Service/myprofie.service.ts
@@ -1,8 +1,8 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
- reducerPath: "api",
+export const myProfile = createApi({
+ reducerPath: "myProfile",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = myProfile;
export type Post = {
id: number;
diff --git a/src/Redux/Service/privacy.policy.service.ts b/src/Redux/Service/privacy.policy.service.ts
index ccad2a2..b7e3126 100644
--- a/src/Redux/Service/privacy.policy.service.ts
+++ b/src/Redux/Service/privacy.policy.service.ts
@@ -1,8 +1,8 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
- reducerPath: "api",
+export const privacyPolicy = createApi({
+ reducerPath: "privacyPolicy",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = privacyPolicy;
export type Post = {
id: number;
diff --git a/src/Redux/Service/privacy.service.ts b/src/Redux/Service/privacy.service.ts
index ccad2a2..9ee8b09 100644
--- a/src/Redux/Service/privacy.service.ts
+++ b/src/Redux/Service/privacy.service.ts
@@ -1,8 +1,8 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
- reducerPath: "api",
+export const privacy = createApi({
+ reducerPath: "privacy",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = privacy;
export type Post = {
id: number;
diff --git a/src/Redux/Service/register.user.service.ts b/src/Redux/Service/register.user.service.ts
index ccad2a2..801912d 100644
--- a/src/Redux/Service/register.user.service.ts
+++ b/src/Redux/Service/register.user.service.ts
@@ -2,7 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
export const registerUser = createApi({
- reducerPath: "api",
+ reducerPath: "registerUser",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
diff --git a/src/Redux/Service/terms.and.condition.service.ts b/src/Redux/Service/terms.and.condition.service.ts
index ccad2a2..7a7e445 100644
--- a/src/Redux/Service/terms.and.condition.service.ts
+++ b/src/Redux/Service/terms.and.condition.service.ts
@@ -1,7 +1,7 @@
import { createApi } from "@reduxjs/toolkit/query";
import { baseQueryWithReauth } from "./apiSlice";
-export const registerUser = createApi({
+export const termsAndCondition = createApi({
reducerPath: "api",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
@@ -17,7 +17,7 @@ export const registerUser = createApi({
}),
});
- export const { } = registerUser;
+ export const { } = termsAndCondition;
export type Post = {
id: number;
diff --git a/src/Redux/Store.tsx b/src/Redux/Store.tsx
index 5d4218b..428a383 100644
--- a/src/Redux/Store.tsx
+++ b/src/Redux/Store.tsx
@@ -6,6 +6,14 @@ import { deactivatedAccounts } from "./Service/deactivated.account.service";
import { faqs } from "./Service/faqs.service";
import { managePosts } from "./Service/manage.posts.service";
import { manageSubAdmin } from "./Service/manage.subadmin.service";
+import { manageJobs } from "./Service/manage.jobs.service";
+import { manageGroups } from "./Service/manage.groups.service";
+import { manageContactUs } from "./Service/manage.contactus.service";
+import { aboutUs } from "./Service/manage.aboutus.service";
+import { privacyPolicy } from "./Service/privacy.policy.service";
+import { privacy } from "./Service/privacy.service";
+import { myProfile } from "./Service/myprofie.service";
+import { masterModule } from "./Service/master.module.service";
export const store = configureStore({
reducer: {
@@ -15,28 +23,31 @@ export const store = configureStore({
[faqs.reducerPath]: faqs.reducer,
[managePosts.reducerPath]: managePosts.reducer,
[manageSubAdmin.reducerPath]: manageSubAdmin.reducer,
-
-
-
-
-
-
- [registerUser.reducerPath]: registerUser.reducer,
- [registerUser.reducerPath]: registerUser.reducer,
- [registerUser.reducerPath]: registerUser.reducer,
- [registerUser.reducerPath]: registerUser.reducer,
- [registerUser.reducerPath]: registerUser.reducer,
- [registerUser.reducerPath]: registerUser.reducer,
+ [manageJobs.reducerPath]: manageJobs.reducer,
+ [manageGroups.reducerPath]: manageGroups.reducer,
+ [manageContactUs.reducerPath]: manageContactUs.reducer,
+ [aboutUs.reducerPath]: aboutUs.reducer,
+ [privacyPolicy.reducerPath]: privacyPolicy.reducer,
+ [privacy.reducerPath]: privacy.reducer,
+ [myProfile.reducerPath]: myProfile.reducer,
+ [masterModule.reducerPath]: masterModule.reducer,
auth: authReducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(
dashboard.middleware,
- registerUser.middleware,
deactivatedAccounts.middleware,
managePosts.middleware,
faqs.middleware,
manageSubAdmin.middleware,
+ manageJobs.middleware,
+ manageGroups.middleware,
+ manageContactUs.middleware,
+ aboutUs.middleware,
+ privacyPolicy.middleware,
+ privacy.middleware,
+ myProfile.middleware,
+ masterModule.middleware,
),
});
From a9cf30252b72db3da48fe7e748a32f14bc887ad4 Mon Sep 17 00:00:00 2001
From: "Siddhesh.More"
Date: Tue, 11 Feb 2025 12:44:43 +0530
Subject: [PATCH 8/9] [ route update ]
---
.env | 2 +-
dev-dist/sw.js | 2 +-
src/App.tsx | 58 +++++++++++++++++++++++++++++++++-----------------
3 files changed, 41 insertions(+), 21 deletions(-)
diff --git a/.env b/.env
index b24b765..78f19ee 100644
--- a/.env
+++ b/.env
@@ -1,5 +1,5 @@
VITE_API_URL='https://ssa.betadelivery.com/apia/v1'
# VITE_API_URL='http://192.16.50.44/seo-backend/apia/v1'
VITE_USER_NAME="Admin"
-VITE_PASSWORD="71%@L%es^bUX94`J9XT*%4&^%tUU^%Q^ffgt"
+VITE_PASSWORD="71%@L%es^bUX94`J9XT*@bh,._WWM{$%^^&&"
VITE_APP_NAME=MyViteApp
\ No newline at end of file
diff --git a/dev-dist/sw.js b/dev-dist/sw.js
index acea9fc..a44d858 100644
--- a/dev-dist/sw.js
+++ b/dev-dist/sw.js
@@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
- "revision": "0.i87c5gdh6n"
+ "revision": "0.g82l9bbo3ro"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
diff --git a/src/App.tsx b/src/App.tsx
index 2b7873a..5109343 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,24 +1,44 @@
-import { Route, BrowserRouter as Router, Routes } from "react-router-dom";
-import DefaultLayout from './Layouts/DefaultLayout';
-import Login from './Pages/Login';
-import { RouteLink } from './Routes/Routes';
+import { useEffect, useState } from "react";
+import { Route, BrowserRouter as Router, Routes, Navigate } from "react-router-dom";
+import DefaultLayout from "./Layouts/DefaultLayout";
+import Login from "./Pages/Login";
+import { RouteLink } from "./Routes/Routes";
import Cookies from "js-cookie";
-function App() {
- // const context = useContext(GlobalStateContext);
- // if (!context) throw new Error('App must be used within a GlobalStateProvider');
- // const { isAuthenticate } = context;
- const token = Cookies.get("token")
+function App() {
+ const [token, setToken] = useState(null);
- return (
-
-
- } />
- {RouteLink.map(({ path, Component }, index) => (} />))}) : ()} />
- } />
-
-
- );
-}
+ useEffect(() => {
+ const savedToken = Cookies.get("token");
+ console.log("Token from Cookies:", savedToken);
+ setToken(savedToken || null);
+ }, []);
+
+ return (
+
+
+ } />
+
+
+ {RouteLink.map(({ path, Component }, index) => (
+ } />
+ ))}
+ } />
+
+
+ ) : (
+
+ )
+ }
+ />
+ } />
+
+
+ );
+}
export default App;
From e9fe9410ac19f728287bec0ab39daf16f608ede2 Mon Sep 17 00:00:00 2001
From: "Siddhesh.More"
Date: Tue, 11 Feb 2025 13:53:51 +0530
Subject: [PATCH 9/9] updaste dashboard
---
src/App.tsx | 60 ++++--------
src/Layouts/DefaultLayout.tsx | 22 +++--
src/Pages/Dashboard/Dashboard.tsx | 12 ++-
src/Pages/ManageCMS/AboutUs/AboutUs.tsx | 9 ++
src/Redux/Service/apiSlice.tsx | 3 +-
src/Redux/Service/authSlice.tsx | 7 +-
src/Redux/Service/manage.aboutus.service.ts | 101 ++++++++++++++++----
src/components/MainFrame.tsx | 8 +-
src/index.css | 27 +++++-
9 files changed, 164 insertions(+), 85 deletions(-)
diff --git a/src/App.tsx b/src/App.tsx
index 5109343..b9302aa 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,44 +1,24 @@
-import { useEffect, useState } from "react";
-import { Route, BrowserRouter as Router, Routes, Navigate } from "react-router-dom";
-import DefaultLayout from "./Layouts/DefaultLayout";
-import Login from "./Pages/Login";
-import { RouteLink } from "./Routes/Routes";
-import Cookies from "js-cookie";
+import { useContext } from 'react';
+import { Route, BrowserRouter as Router, Routes } from "react-router-dom";
+import GlobalStateContext from './Contexts/GlobalStateContext';
+import DefaultLayout from './Layouts/DefaultLayout';
+import Login from './Pages/Login';
+import { RouteLink } from './Routes/Routes';
-function App() {
- const [token, setToken] = useState(null);
+function App() {
+ const context = useContext(GlobalStateContext);
+ if (!context) throw new Error('App must be used within a GlobalStateProvider');
+ const { isAuthenticate } = context;
- useEffect(() => {
- const savedToken = Cookies.get("token");
- console.log("Token from Cookies:", savedToken);
- setToken(savedToken || null);
- }, []);
-
- return (
-
-
- } />
-
-
- {RouteLink.map(({ path, Component }, index) => (
- } />
- ))}
- } />
-
-
- ) : (
-
- )
- }
- />
- } />
-
-
- );
-}
+ return (
+
+
+ } />
+ {RouteLink.map(({ path, Component }, index) => (} />))}) : ()} />
+ } />
+
+
+ );
+}
export default App;
diff --git a/src/Layouts/DefaultLayout.tsx b/src/Layouts/DefaultLayout.tsx
index b52e7d5..2e63eae 100644
--- a/src/Layouts/DefaultLayout.tsx
+++ b/src/Layouts/DefaultLayout.tsx
@@ -6,8 +6,12 @@ import { nav } from "../Routes/Nav";
import logo from '../assets/logo.svg';
import { AccordionItem, AccordionItemContent, AccordionItemTrigger, AccordionRoot } from "../components/ui/accordion";
import { Avatar } from "../components/ui/avatar";
+import { LuLogOut } from "react-icons/lu";
+import { logout, setToken } from "../Redux/Service/authSlice";
+import { useDispatch } from "react-redux";
const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => {
+ const dispatch = useDispatch()
const navigate = useNavigate()
const location = useLocation()
@@ -15,25 +19,31 @@ const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => {
return (
-
+
-
+
-
+
{nav?.map(({ title, path, Icon, type, children }, index) => type === 'single' ?
{title} :
-
+
navigate(path)} gap={0} style={{ cursor: 'pointer', borderRadius: '8px', padding: '5px', width: '100%', display: 'flex', alignItems: 'center', border: '1px solid #ffffff', backgroundColor:'#fff',color:'#000', fontSize: '14px', }}> {title}
{children?.map(({ title, path, Icon }, index) => navigate(path)} style={{ marginTop: 6, cursor: 'pointer', borderRadius: '8px', padding: '6px', width: '100%', display: 'flex', alignItems: 'center', gap: 6, border: '1px solid #ffffff', backgroundColor:'#fff',color:'#919198' }} > {title})}
)}
+
+
+ {dispatch(logout()), navigate('/login')}} className="link" style={{ cursor: 'pointer', borderRadius: '8px', padding: '6px', width: '100%', display: 'flex', alignItems: 'center', gap: 6, border: '1px solid #ffffff', backgroundColor:'#fff', color:'#000', boxShadow:'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px'}} > Logout
+
-
-
+
+
+
+
navigate('/profile')} >
diff --git a/src/Pages/Dashboard/Dashboard.tsx b/src/Pages/Dashboard/Dashboard.tsx
index 056fa6c..10539a7 100644
--- a/src/Pages/Dashboard/Dashboard.tsx
+++ b/src/Pages/Dashboard/Dashboard.tsx
@@ -67,8 +67,8 @@ const Dashboard = () => {
return (
-
-
+
+
Total Users
@@ -117,6 +117,7 @@ const Dashboard = () => {
@@ -140,13 +141,14 @@ const Dashboard = () => {
w={"20%"}
boxShadow={"rgba(99, 99, 99, 0.2) 0px 2px 8px 0px"}
p={'10px'}
+ rounded={'lg'}
>
Number Of Groups created
-
-
+
+
Faqs
{
))}
-
+
diff --git a/src/Pages/ManageCMS/AboutUs/AboutUs.tsx b/src/Pages/ManageCMS/AboutUs/AboutUs.tsx
index a080942..c704868 100644
--- a/src/Pages/ManageCMS/AboutUs/AboutUs.tsx
+++ b/src/Pages/ManageCMS/AboutUs/AboutUs.tsx
@@ -2,9 +2,18 @@ import { Box, HStack, Text } from "@chakra-ui/react";
import MainFrame from "../../../components/MainFrame"
import { p } from "framer-motion/client";
import AboutUsAddModel from "../../ManageCMS/AboutUs/AboutUsAddModel";
+import { useGetAboutUsQuery } from "../../../Redux/Service/manage.aboutus.service";
const AboutUs = () => {
+
+ const {
+ data
+ } = useGetAboutUsQuery()
+
+ console.log('====================================');
+ console.log(data);
+ console.log('====================================');
return (
diff --git a/src/Redux/Service/apiSlice.tsx b/src/Redux/Service/apiSlice.tsx
index 46513e4..13eb4e6 100644
--- a/src/Redux/Service/apiSlice.tsx
+++ b/src/Redux/Service/apiSlice.tsx
@@ -15,7 +15,7 @@ const baseQuery = fetchBaseQuery({
if (token) {
headers.set("Authorization", `Basic ${basicAuth}`);
- headers.set("access-token", `Bearer ${token}`);
+ headers.set("access-token", `${token}`);
}
headers.set("Content-Type", "application/json");
@@ -23,6 +23,7 @@ const baseQuery = fetchBaseQuery({
},
});
+
// ✅ Handle 401 Errors (Auto Logout)
export const baseQueryWithReauth: BaseQueryFn<
string | FetchArgs,
diff --git a/src/Redux/Service/authSlice.tsx b/src/Redux/Service/authSlice.tsx
index 38ad1c4..253117e 100644
--- a/src/Redux/Service/authSlice.tsx
+++ b/src/Redux/Service/authSlice.tsx
@@ -1,12 +1,11 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
-import Cookies from "js-cookie";
type AuthState = {
token: string | null;
};
const initialState: AuthState = {
- token: Cookies.get("token") || null, // Load token from cookies
+ token: localStorage.getItem("token") || null, // ✅ Ensures token is either a string or null
};
const authSlice = createSlice({
@@ -15,11 +14,11 @@ const authSlice = createSlice({
reducers: {
setToken: (state, action: PayloadAction) => {
state.token = action.payload;
- Cookies.set("token", action.payload, { expires: 7, secure: true, sameSite: "Strict" }); // Store in cookies for 7 days
+ localStorage.setItem("token", action.payload); // ✅ Store token in localStorage
},
logout: (state) => {
state.token = null;
- Cookies.remove("token");
+ localStorage.removeItem("token"); // ✅ Remove token from localStorage on logout
},
},
});
diff --git a/src/Redux/Service/manage.aboutus.service.ts b/src/Redux/Service/manage.aboutus.service.ts
index bda6a51..300f497 100644
--- a/src/Redux/Service/manage.aboutus.service.ts
+++ b/src/Redux/Service/manage.aboutus.service.ts
@@ -1,26 +1,85 @@
-import { createApi } from "@reduxjs/toolkit/query";
+import { createApi } from "@reduxjs/toolkit/query/react";
import { baseQueryWithReauth } from "./apiSlice";
export const aboutUs = createApi({
- reducerPath: "aboutUs",
- baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
- endpoints: (builder) => ({
-
-
-
- getPosts: builder.query({ query: () => "/posts" }),
-
-
-
-
-
+ reducerPath: "aboutUs",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ endpoints: (builder) => ({
+
+
+
+ // 🔹 GET: Fetch all posts
+ getAboutUs: builder.query({
+ query: () => "/about-us",
}),
- });
+
+
+
+
+
+ // 🔹 GET: Fetch a single post by ID
+ getPostById: builder.query({
+ query: (id) => `/posts/${id}`,
+ }),
+
+ // 🔹 POST: Create a new post
+ createPost: builder.mutation>({
+ query: (newPost) => ({
+ url: "/posts",
+ method: "POST",
+ body: newPost,
+ }),
+ }),
+
+ // 🔹 PUT: Update an existing post
+ updatePost: builder.mutation }>({
+ query: ({ id, updatedData }) => ({
+ url: `/posts/${id}`,
+ method: "PUT",
+ body: updatedData,
+ }),
+ }),
+
+ // 🔹 DELETE: Remove a post by ID
+ deletePost: builder.mutation<{ success: boolean }, number>({
+ query: (id) => ({
+ url: `/posts/${id}`,
+ method: "DELETE",
+ }),
+ }),
+ }),
+});
+
+export const {
+ useGetAboutUsQuery,
+
+
+
+
+
+
+
+
+
+
- export const { } = aboutUs;
-
- export type Post = {
- id: number;
- title: string;
- body: string;
- };
\ No newline at end of file
+ useGetPostByIdQuery,
+ useCreatePostMutation,
+ useUpdatePostMutation,
+ useDeletePostMutation
+} = aboutUs;
+
+// Define Post type
+export type Post = {
+ id: number;
+ title: string;
+ body: string;
+};
+
+
+export type AboutUs = {
+ id: number;
+ language_master_xid: number;
+ content: string;
+ is_active: boolean;
+};
diff --git a/src/components/MainFrame.tsx b/src/components/MainFrame.tsx
index 575830b..2646c63 100644
--- a/src/components/MainFrame.tsx
+++ b/src/components/MainFrame.tsx
@@ -13,13 +13,13 @@ interface MainFrameProps {
const MainFrame: FC = ({ children }) => {
return (
-
+
diff --git a/src/index.css b/src/index.css
index ff86a1b..521b87f 100644
--- a/src/index.css
+++ b/src/index.css
@@ -156,12 +156,31 @@ body {
/* Border around the thumb */
}
-/* Style the scrollbar thumb on hover */
-::-webkit-scrollbar-thumb:hover {
- background-color: #555;
- /* Darker gray when hovered */
+/* Scrollbar width */
+::-webkit-scrollbar {
+ width: 8px;
+ height: 8px;
+ cursor: pointer;
}
+/* Scrollbar track */
+::-webkit-scrollbar-track {
+ background: transparent; /* No visible track */
+}
+
+/* Scrollbar thumb (the draggable part) */
+::-webkit-scrollbar-thumb {
+ background: rgba(0, 0, 0, 0.3); /* Light black (30% opacity) */
+ border-radius: 10px; /* Rounded edges */
+ transition: background 0.3s;
+}
+
+/* On hover, make it darker */
+::-webkit-scrollbar-thumb:hover {
+ background: rgba(0, 0, 0, 0.5);
+}
+
+
input:focus-visible {
border: none !important;
}