From f9fe783ade6fb72d352b93c17ea4f2c85e1b19fc Mon Sep 17 00:00:00 2001 From: Sameer Shaik Date: Sun, 1 Dec 2024 03:48:33 +0530 Subject: [PATCH] fix: dashboard sidebar and url path locator --- client/package-lock.json | 71 ++++++++++++++++++ client/package.json | 2 + client/src/App.tsx | 46 +++++++++++- client/src/assets/arrow-left.svg | 1 + client/src/assets/arrow-right.svg | 1 + client/src/assets/react.svg | 1 - client/src/components/pages/Auth.tsx | 18 +++-- client/src/components/pages/Dashboard.tsx | 26 +++++++ client/src/components/pages/Error.tsx | 15 ++++ client/src/components/pages/Home.tsx | 1 - client/src/components/pages/Profile.tsx | 14 ++++ client/src/components/pages/components.tsx | 49 ++++++++++++ client/src/components/ui/RedirectButton.tsx | 21 ++++++ client/src/components/utilities/Routes.tsx | 4 +- client/src/lib/hooks.ts | 0 client/src/lib/utils.ts | 7 +- client/src/main.tsx | 10 ++- .../flowcharts/skinai_flowchart.drawio.png | Bin generated_image.png | Bin 2050 -> 0 bytes .../predect_disease.cpython-311.pyc | Bin 0 -> 2109 bytes model/Model/predect_disease.py | 2 +- model/app.py | 2 +- model/requirements.txt | 4 + server/controller/UserController.js | 4 +- 24 files changed, 277 insertions(+), 22 deletions(-) create mode 100644 client/src/assets/arrow-left.svg create mode 100644 client/src/assets/arrow-right.svg delete mode 100644 client/src/assets/react.svg create mode 100644 client/src/components/pages/Dashboard.tsx create mode 100644 client/src/components/pages/Error.tsx create mode 100644 client/src/components/pages/Profile.tsx create mode 100644 client/src/components/pages/components.tsx create mode 100644 client/src/components/ui/RedirectButton.tsx create mode 100644 client/src/lib/hooks.ts rename skinai_flowchart.drawio.png => designs/flowcharts/skinai_flowchart.drawio.png (100%) delete mode 100644 generated_image.png create mode 100644 model/Model/__pycache__/predect_disease.cpython-311.pyc create mode 100644 model/requirements.txt diff --git a/client/package-lock.json b/client/package-lock.json index dc6fdec..14d7188 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -13,10 +13,12 @@ "axios": "^1.7.7", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "dropzone": "^6.0.0-beta.2", "framer-motion": "^11.11.5", "lucide-react": "^0.451.0", "react": "^18.3.1", "react-dom": "^18.3.1", + "react-dropzone": "^14.3.5", "react-hook-form": "^7.53.0", "react-router-dom": "^6.26.2", "sweetalert": "^2.1.2", @@ -4784,6 +4786,14 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "node_modules/attr-accept": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-2.2.5.tgz", + "integrity": "sha512-0bDNnY/u6pPwHDMoF0FieU354oBi0a8rD9FcsLwzcGWbc8KS8KPIi7y+s13OlVY+gMWc/9xEMUgNE6Qm8ZllYQ==", + "engines": { + "node": ">=4" + } + }, "node_modules/autoprefixer": { "version": "10.4.20", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.20.tgz", @@ -5188,6 +5198,20 @@ "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==" }, + "node_modules/dropzone": { + "version": "6.0.0-beta.2", + "resolved": "https://registry.npmjs.org/dropzone/-/dropzone-6.0.0-beta.2.tgz", + "integrity": "sha512-k44yLuFFhRk53M8zP71FaaNzJYIzr99SKmpbO/oZKNslDjNXQsBTdfLs+iONd0U0L94zzlFzRnFdqbLcs7h9fQ==", + "dependencies": { + "@swc/helpers": "^0.2.13", + "just-extend": "^5.0.0" + } + }, + "node_modules/dropzone/node_modules/@swc/helpers": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.2.14.tgz", + "integrity": "sha512-wpCQMhf5p5GhNg2MmGKXzUNwxe7zRiCsmqYsamez2beP7mKPCSiu+BjZcdN95yYSzO857kr0VfQewmGpS77nqA==" + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -5579,6 +5603,17 @@ "node": ">=16.0.0" } }, + "node_modules/file-selector": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/file-selector/-/file-selector-2.1.1.tgz", + "integrity": "sha512-pJVY80PuSiHbnYEZ0gZYQf15x0z/lkeIF1yn95yRC/Usb43343ewXtMClQ9GLPvPm4/SscX4zvQz9QhCAyLqlg==", + "dependencies": { + "tslib": "^2.7.0" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -6049,6 +6084,11 @@ "node": ">=6" } }, + "node_modules/just-extend": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-5.1.1.tgz", + "integrity": "sha512-b+z6yF1d4EOyDgylzQo5IminlUmzSeqR1hs/bzjBNjuGras4FXq/6TrzjxfN0j+TmI0ltJzTNlqXUMCniciwKQ==" + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -6599,6 +6639,16 @@ "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.1.0.tgz", "integrity": "sha512-g0LWaH0gFsxovsU7R5LrrhHhWAWiHRnh1GPrhXnPgYsDkIqjRYUYSZEsej/wtleDrz5xVSIDbeKfidztp2XHFQ==" }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -6655,6 +6705,22 @@ "react": "^18.3.1" } }, + "node_modules/react-dropzone": { + "version": "14.3.5", + "resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-14.3.5.tgz", + "integrity": "sha512-9nDUaEEpqZLOz5v5SUcFA0CjM4vq8YbqO0WRls+EYT7+DvxUdzDPKNCPLqGfj3YL9MsniCLCD4RFA6M95V6KMQ==", + "dependencies": { + "attr-accept": "^2.2.4", + "file-selector": "^2.1.0", + "prop-types": "^15.8.1" + }, + "engines": { + "node": ">= 10.13" + }, + "peerDependencies": { + "react": ">= 16.8 || 18.0.0" + } + }, "node_modules/react-hook-form": { "version": "7.53.0", "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.53.0.tgz", @@ -6670,6 +6736,11 @@ "react": "^16.8.0 || ^17 || ^18 || ^19" } }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + }, "node_modules/react-refresh": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", diff --git a/client/package.json b/client/package.json index e157e3d..281f23c 100644 --- a/client/package.json +++ b/client/package.json @@ -16,10 +16,12 @@ "axios": "^1.7.7", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "dropzone": "^6.0.0-beta.2", "framer-motion": "^11.11.5", "lucide-react": "^0.451.0", "react": "^18.3.1", "react-dom": "^18.3.1", + "react-dropzone": "^14.3.5", "react-hook-form": "^7.53.0", "react-router-dom": "^6.26.2", "sweetalert": "^2.1.2", diff --git a/client/src/App.tsx b/client/src/App.tsx index 097d61a..d82271d 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,9 +1,49 @@ -import Home from "@/components/pages/Home"; +import { Outlet, useNavigate, useLocation } from "react-router-dom"; +import { Routes } from "./components/utilities/Routes"; + +const SidebarItem = ({ text, to }: { text: string; to: string }) => { + const navigate = useNavigate(); + const current = useLocation(); + const cur: boolean = current.pathname + .toLowerCase() + .includes(text.toLowerCase()); + + return ( +
navigate(to)} + > + {text} +
+ ); +}; export default function App() { + const navigate = useNavigate(); + // const [current, setCurrent] = useState("Dashboard"); return ( -
- +
+
+ navigate(Routes.HOME)} + > + SKIN.AI + +
+ + +
+
+
+ +
); } diff --git a/client/src/assets/arrow-left.svg b/client/src/assets/arrow-left.svg new file mode 100644 index 0000000..a19aa09 --- /dev/null +++ b/client/src/assets/arrow-left.svg @@ -0,0 +1 @@ +4-Arrow Left \ No newline at end of file diff --git a/client/src/assets/arrow-right.svg b/client/src/assets/arrow-right.svg new file mode 100644 index 0000000..2e23a1d --- /dev/null +++ b/client/src/assets/arrow-right.svg @@ -0,0 +1 @@ +3-Arrow Right \ No newline at end of file diff --git a/client/src/assets/react.svg b/client/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/client/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/client/src/components/pages/Auth.tsx b/client/src/components/pages/Auth.tsx index 41e8dd6..c4bae23 100644 --- a/client/src/components/pages/Auth.tsx +++ b/client/src/components/pages/Auth.tsx @@ -5,6 +5,8 @@ import { useForm } from "react-hook-form"; import { AuthForm } from "../utilities/Auth.ds"; import axios from "axios"; import "../../styles/auth.css"; +import { Routes } from "../utilities/Routes"; +import swal from "sweetalert"; export default function Auth() { const navigate = useNavigate(); @@ -43,10 +45,10 @@ export default function Auth() { password: data.password, } ); - - if (response.status === 201) { - alert("Success"); - return navigate("/app"); + if (response.status === 200) { + localStorage.setItem("token", response.data.token); + swal("Logged", "User logged successfully", "success"); + return navigate(Routes.APP); } } catch (error) { console.error("Login failed:", error); @@ -75,11 +77,13 @@ export default function Auth() { mobile: data.mobile, profileImage: data.profileURL || null, }) - .then((res) => { - console.log(res.data); + .then(() => { + localStorage.removeItem("token"); + swal("Registered", "User Registered", "success"); + return navigate(Routes.AUTH); }); } catch (error) { - console.log("error"); + console.log(`${error}`); } finally { reset(); setLoad(false); diff --git a/client/src/components/pages/Dashboard.tsx b/client/src/components/pages/Dashboard.tsx new file mode 100644 index 0000000..7226320 --- /dev/null +++ b/client/src/components/pages/Dashboard.tsx @@ -0,0 +1,26 @@ +import { useLocation } from "react-router-dom"; +import { MetricCard, URLPath, UserCard } from "./components"; + +export default function Dashboard() { + // const navigate = useNavigate(); + const path = useLocation().pathname; + return ( +
+
+ +
+ +
+ + + Hey! Sameer + + + +
+
+ ); +} diff --git a/client/src/components/pages/Error.tsx b/client/src/components/pages/Error.tsx new file mode 100644 index 0000000..b3992b9 --- /dev/null +++ b/client/src/components/pages/Error.tsx @@ -0,0 +1,15 @@ +import RedirectButton from "../ui/RedirectButton"; +import { Routes } from "../utilities/Routes"; + +export default function Error() { + return ( +
+ Error 404 + Page Not Found + +
+ ); +} diff --git a/client/src/components/pages/Home.tsx b/client/src/components/pages/Home.tsx index 6daaec8..5c76c4f 100644 --- a/client/src/components/pages/Home.tsx +++ b/client/src/components/pages/Home.tsx @@ -1,4 +1,3 @@ -// import GridPattern from "../ui/animated-grid-pattern"; import { motion } from "framer-motion"; import WordRotate from "../ui/word-rotate"; import { Button } from "@nextui-org/react"; diff --git a/client/src/components/pages/Profile.tsx b/client/src/components/pages/Profile.tsx new file mode 100644 index 0000000..f705d98 --- /dev/null +++ b/client/src/components/pages/Profile.tsx @@ -0,0 +1,14 @@ +// import { getCurrentPathUsingUrl } from "@/lib/utils"; +import { useLocation } from "react-router-dom"; +import { URLPath } from "./components"; + +export default function Profile() { + const path = useLocation().pathname; + return ( +
+ + + +
+ ); +} diff --git a/client/src/components/pages/components.tsx b/client/src/components/pages/components.tsx new file mode 100644 index 0000000..670fb75 --- /dev/null +++ b/client/src/components/pages/components.tsx @@ -0,0 +1,49 @@ +import { User } from "@nextui-org/user"; + +import { Card, CardBody, CardHeader } from "@nextui-org/card"; + +export const URLPath = ({ path }: { path: string }) => { + const urldata = path.toUpperCase().split("/").splice(1); + return ( +
+ {urldata.join(" > ")} +
+ ); +}; + +export function UserCard() { + return ( + + ); +} + +export function MetricCard({ + title, + count, +}: { + title: string; + count: number | null; +}) { + return ( + + +

{title}

+ {count ? ( +

{count}

+ ) : ( +

No Data

+ )} +
+ + till now + +
+ ); +} diff --git a/client/src/components/ui/RedirectButton.tsx b/client/src/components/ui/RedirectButton.tsx new file mode 100644 index 0000000..6340b4d --- /dev/null +++ b/client/src/components/ui/RedirectButton.tsx @@ -0,0 +1,21 @@ +import { useNavigate } from "react-router-dom"; + +export default function RedirectButton({ + to, + className, +}: { + to: string; + className?: string; +}) { + const navigate = useNavigate(); + const back = "Redirect Back to home"; + return ( +
navigate(to)} + className={className} + style={{ textDecoration: "underline", cursor: "pointer" }} + > + {back} +
+ ); +} diff --git a/client/src/components/utilities/Routes.tsx b/client/src/components/utilities/Routes.tsx index 9c95c9d..3a8c1d7 100644 --- a/client/src/components/utilities/Routes.tsx +++ b/client/src/components/utilities/Routes.tsx @@ -2,7 +2,7 @@ export enum Routes { HOME = "/", AUTH = "/auth", APP = "/app", - DASHBOARD = "", + DASHBOARD = "dashboard", PROFILE = "profile", - ERROR = "/error", + ERROR = "*", } diff --git a/client/src/lib/hooks.ts b/client/src/lib/hooks.ts new file mode 100644 index 0000000..e69de29 diff --git a/client/src/lib/utils.ts b/client/src/lib/utils.ts index bd0c391..b791d57 100644 --- a/client/src/lib/utils.ts +++ b/client/src/lib/utils.ts @@ -1,6 +1,7 @@ -import { clsx, type ClassValue } from "clsx" -import { twMerge } from "tailwind-merge" +import { clsx, type ClassValue } from "clsx"; +// import { div, span } from "framer-motion/client"; +import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) + return twMerge(clsx(inputs)); } diff --git a/client/src/main.tsx b/client/src/main.tsx index a46cb9d..e49c36b 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -7,6 +7,9 @@ import App from "./App.tsx"; import "./index.css"; import Home from "./components/pages/Home.tsx"; import Auth from "./components/pages/Auth.tsx"; +import Dashboard from "./components/pages/Dashboard.tsx"; +import Profile from "./components/pages/Profile.tsx"; +import Error from "./components/pages/Error.tsx"; createRoot(document.getElementById("root")!).render( @@ -20,7 +23,12 @@ createRoot(document.getElementById("root")!).render( } /> } /> - } /> + }> + } /> + } /> + } /> + + } /> diff --git a/skinai_flowchart.drawio.png b/designs/flowcharts/skinai_flowchart.drawio.png similarity index 100% rename from skinai_flowchart.drawio.png rename to designs/flowcharts/skinai_flowchart.drawio.png diff --git a/generated_image.png b/generated_image.png deleted file mode 100644 index f0db796f3d7c6bd96b02520a7f763a4003576424..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2050 zcmd6oZ8Xyh9LN9v*(Pf&+9~t2I&#w`lr);Qt1I16LTZb0x4LMS?z)V5+>(b9rGzq3 zU4@L+aYMFdYlpf=9=e`3#QwL7NUY0-My_*T+_(2_Z@%Yu&iDMz`JV5K&-ZeG{{dr^ z1quKFW6BTSK>z^et=_NJz*dzKzv(Fe82(Q2_6p{fd>lG?=|m)$^=W*|V6??xSFUf+ zWu`?)^r66|gR_D8yV5QcrtR{z!}=j?X;pAZ0G#Y3$qVzbds1o7y?2S=yO!Bocy4!e z)BcM!^%>sTJv3Gwg_%E)_pXKg!o!28!o>@2ujm%f)8d9*BS+$IPt`?sOqJWWnNfU2 z^scpe;(>13oze-4iP)1dFC--C-TO*g&8rwYWapfYiD;lr~?znI7Cg$C{N zEH!$HPf$Z+wdZMYOQ)_$?CaI9n)F`wx{e+sKK%-02~1Vz;xAS(_Bu8Nw23QqfydE( z$#GUvR5f&p2L71Fn~zgpVH1Sufi#c^WsoX{(OcCM1FuLlL#iSPk`FAT+6y`jJIVU( zBGh!&Q4u`OpP-Ln6D8|g)mJnjF*D{s(fpz{)7)H`z(VyYo@>rE8t#_a(AKULPsqlh z?=>lnNGX~{cTR?z%)9D6I#JhTj0HFl3OTcX8{l*xgkcdp9Lc~EGHI-J)7FV>QV{~R ziPErvFynGeU+FT+hBYu7@a=Q_+N$YA1RxD1>KcIL`ldw+;9pN_M)2`{CPQmwhn9u2 zcpzEY^vsZNWDoTNOOgTYc^a&uTHxA|>I#U9yL_~hCA^$1aiY+oa*3llEeo$M3wIirRV zJ08o+b~~C>JWJ&o`#^*3`jWJ64OaN^?*fdM5uv`7@B&cW-$MBbfc1jLOPfa!`tDczYI$VK&Sk)kw#7`atWf&Xgv! zr|Ld1ur|>qB%|<{zn+k!7-Q2;(O5-`hUpF)sWScoYlX6BOCL!L>gAi2CoPw@d7>>D z;bm<~SiZ}f#KHDcG((JxED%SK_2Fzwt8_fob}Ph6aSBzix~R)y^Mwz#iY88&-O^aB zcu%LGL+TQbt%a$PO2i-obj%okM2ywfWhz8gd;y*Ml!fy=Vy#Tbr|X|ebh@_5GS%S_ zaYy0YO#3HXz*_iIjVt^dhe`$THgh}YHvA;&Y1jz$ zs+M_4f2_Q$NWal!E_LT-eqC_?m)RU;y`a6!Z#LkC9kV&YBlax}$k-?Fz1l*>?xR~+oTG@EDtIn=! zTS!!gKuak!1w%udP|-u0kRE#Jq0k=kAFMzJF<>y19CA}h3n8bzS$$b8&V>6r9xZBYbJ&(ciS;xA>LyGY9+H=SVO`!A05;i?s{B5+! zap*SU;4zL*Ae&{>8k2}bIb;XgdjtpWjle7oVG}j|*r6`+Zig+RUYn9o6e|0obbwIA zgGl>uS9{mr=8Fe$Vo_AY0z@x~Jrwz zi{1ly1$v@%PF)Nfzy*77;f}w9xKPnw434zbs1z=Siyzb}gr(N(W;|-iu8Su2Ui7m-6 zZE4-i8%j*NsjJvhCHamjZ%B6AGKcLu5;hdcCfgFuV9kh4d0v(wPvQfTaTDG%KOn3F zq0I%nrCCz}$}c7ts3(1k@>gePsV9*FCIymfb5yvMSem8$63F?F(kTG@7gZe_W)>Iv znw-3CYqFG9Kg(N%{;Sx+x-_fmKroTDCNLq}ngO7cO0aEOnpHS*RW-DX(Us6c*Hn@P z?Yg!`nD@iCuqEepOr!$i(vgvLMtvG>zmf5bVIt@@3c-*DO!A_EK@{p&@M=-1cp z7pmbCweX2@vL5dHX5p)a2cy;SWGy^dPVPqgcg{SBe>=T1T~6&qk5$BK^kg~p0>rV( z(O=Iy(Rei)uSMga4JRCTmXi%3IOuJlHYukY!|3?rkJ<0DPg2$KncDb_BOKiw9Ny6! z>0)(orZzZJzOg$t{&3EjxLh5(QX9MC2qSyLrz)SYLa-2!uvEZ%2#E8jQhj$m-@UjvCH16d;MX!KG?*D{b1mFJw DZwxFT literal 0 HcmV?d00001 diff --git a/model/Model/predect_disease.py b/model/Model/predect_disease.py index 07456dd..09ed18c 100644 --- a/model/Model/predect_disease.py +++ b/model/Model/predect_disease.py @@ -6,7 +6,7 @@ def predict_disease(image_path): - model_path = 'model//Model//skinAI.pkl' + model_path = '/model/Model/skinAI.pkl' try: with open(model_path, 'rb') as file: diff --git a/model/app.py b/model/app.py index cc50ff4..1c80fb6 100644 --- a/model/app.py +++ b/model/app.py @@ -11,7 +11,7 @@ def index(): @app.get("/test") def get_model_name(): - image_path = 'model//Model//SampleImage.jpg' + image_path = 'model/SampleImage.jpg' result = predict_disease(image_path) return result diff --git a/model/requirements.txt b/model/requirements.txt new file mode 100644 index 0000000..2d1338c --- /dev/null +++ b/model/requirements.txt @@ -0,0 +1,4 @@ +Flask==2.3.3 +numpy==1.26.0 +Pillow==10.0.1 +scikit-learn==1.3.1 diff --git a/server/controller/UserController.js b/server/controller/UserController.js index d760e0c..4359b00 100644 --- a/server/controller/UserController.js +++ b/server/controller/UserController.js @@ -19,7 +19,7 @@ const UserLogin = async (req, res) => { userEmail: user.email, }; - const secret = process.env.JWT_SECRET_KEY; + const secret = process.env.JWT_SECRET; const token = jwt.sign(payload, secret, { expiresIn: "1d", }); @@ -47,7 +47,7 @@ const UserLogin = async (req, res) => { SendEmail(email, "Login Successful", Template); - return res.json({ message: "Logged in successfully", token }); + return res.status(200).json({ message: "Logged in successfully", token }); } catch (error) { console.error("Login error:", error); return res