From dab26500a36e495f58a05182f79db0f0ae29d649 Mon Sep 17 00:00:00 2001 From: Abhimanyu-dev Date: Sun, 22 Dec 2024 05:18:09 +0530 Subject: [PATCH] Added user signup and login --- app/auth/login/page.tsx | 200 +++++++++++--- app/auth/signup/page.tsx | 48 +++- app/css/tailwind.css | 2 +- app/student/signup/page.tsx | 430 +++++++++++++++++++------------ callbacks/auth/student/login.ts | 8 +- callbacks/auth/student/otp.ts | 10 +- callbacks/auth/student/signup.ts | 16 +- callbacks/constants.ts | 2 +- package-lock.json | 192 +++++++------- store/store.tsx | 8 - 10 files changed, 599 insertions(+), 317 deletions(-) diff --git a/app/auth/login/page.tsx b/app/auth/login/page.tsx index f0d94ec..52af1d1 100644 --- a/app/auth/login/page.tsx +++ b/app/auth/login/page.tsx @@ -1,59 +1,191 @@ -"use client" -import React, { Suspense, useState } from "react"; +"use client"; +import Visibility from "@mui/icons-material/Visibility"; +import VisibilityOff from "@mui/icons-material/VisibilityOff"; +import { LoadingButton } from "@mui/lab"; +import React, { Suspense, useEffect, useState } from "react"; import { - CircularProgress, + Checkbox, FormControl, + FormHelperText, + IconButton, + InputAdornment, + InputLabel, + OutlinedInput, Stack, - Tab, - Tabs, + TextField, Typography, } from "@mui/material"; -import dynamic from "next/dynamic"; -const SignUpProf = dynamic(() => import("../../admin/login/page"), { - suspense: true, -}); -const SignUpStudent = dynamic(() => import("../../student/login/page"), { - suspense: true, -}); - -function SignUp() { - const [role, setRole] = useState(0); - - const handleRole = (event: React.SyntheticEvent, newRole: number) => { - setRole(newRole); +import studentLoginRequest, { + LoginStudentParams, +} from "@/callbacks/auth/student/login"; +import { useForm } from "react-hook-form"; +import useStore from "@/store/store"; +import { useRouter } from "next/navigation"; +import Link from "next/link"; +import Image from "next/image"; + +function Login() { + const { + register, + handleSubmit, + formState: { errors }, + reset, + } = useForm(); + + const [values, setValues] = useState({ + password: "", + showPassword: false, + }); + const [loading, setLoading] = useState(false); + const { setToken, setRole, setName, setUserID } = useStore(); + + useEffect(() => { + setToken(""); + setRole(0); + setName(""); + setUserID(""); + }, [setToken, setName, setRole, setUserID]); + + const handleClickShowPassword = () => { + setValues({ + ...values, + showPassword: !values.showPassword, + }); }; - function a11yProps(index: number) { - return { - id: `full-width-tab-${index}`, - "aria-controls": `full-width-tabpanel-${index}`, - }; - } + const handleMouseDownPassword = ( + event: React.MouseEvent + ) => { + event.preventDefault(); + }; + + const router = useRouter(); + const onLogin = async (data: LoginStudentParams) => { + setLoading(true); + const response = await studentLoginRequest.post(data); + console.log(response); + if (response.token !== "") { + setToken(response.token); + setRole(response.role_id); + reset({ + email: "", + password: "", + }); + } + setLoading(false); + }; return ( -
+
+ > +
+ iitklogo +
- }> - - + +

Welcome Back!

+
+ + value.trim(), + })} + /> + + + + Password + + + + {values.showPassword ? : } + + + } + label="Password" + /> + {errors.password && ( + + Incorrect password + + )} + + + + + + Remember Me + + + + Forgot password? + + + + + + + Sign In + + + + + Don't have an account?{" "} + + Sign Up + + +
); } -SignUp.layout = "Navigation"; -export default SignUp; \ No newline at end of file +Login.layout = "Navigation"; +export default Login; diff --git a/app/auth/signup/page.tsx b/app/auth/signup/page.tsx index b6ff7ef..8f1f328 100644 --- a/app/auth/signup/page.tsx +++ b/app/auth/signup/page.tsx @@ -8,10 +8,13 @@ import { Tabs, Typography, } from "@mui/material"; +import Image from "next/image"; import dynamic from "next/dynamic"; -const SignUpProf = dynamic(() => import("../../admin/signup/page"), { - suspense: true, -}); + + +// const SignUpProf = dynamic(() => import("../../professor/signUpProf"), { +// suspense: true, +// }); const SignUpStudent = dynamic(() => import("../../student/signup/page"), { suspense: true, }); @@ -31,28 +34,57 @@ function SignUp() { } return ( -
+
+
+ loginPage +
+ +

Sign up

+
+ + + + + + + {role === 0 ? ( }> + ) : ( + <> + // }> + // + // + )}
); } -SignUp.layout="Navigation"; -export default SignUp; \ No newline at end of file + +SignUp.layout = "Navigation"; +export default SignUp; diff --git a/app/css/tailwind.css b/app/css/tailwind.css index c186bcf..d98dfd1 100644 --- a/app/css/tailwind.css +++ b/app/css/tailwind.css @@ -2,7 +2,7 @@ @tailwind components; @tailwind utilities; .contact_us{ - background: url('../../public/images/contact.jpg') no-repeat center center/cover fixed; + /* background: url('../../public/images/contact.jpg') no-repeat center center/cover fixed; */ } .contact_form{ opacity: 0.4; diff --git a/app/student/signup/page.tsx b/app/student/signup/page.tsx index c299860..5a2f901 100644 --- a/app/student/signup/page.tsx +++ b/app/student/signup/page.tsx @@ -1,166 +1,276 @@ -import { useState } from 'react'; -import '../../css/tailwind.css'; -import LoadingButton from '@mui/lab/LoadingButton'; -import Alert from '@mui/material/Alert'; -import Snackbar from '@mui/material/Snackbar'; -import { useForm } from "react-hook-form"; -import studentSignUpRequest, { SignUpStudentParams} from "../../../callbacks/auth/student/signup"; -import otpRequest, { OTPParams } from "../../../callbacks/auth/student/otp"; +import { Visibility, VisibilityOff } from "@mui/icons-material"; +import LoadingButton from "@mui/lab/LoadingButton"; import { - FieldError, - UseFormGetValues, - UseFormHandleSubmit, - UseFormRegister, -} from "react-hook-form"; -export default function Home(){ - const [isOTP,otpstage]=useState(true); - const [laodingotp,setloadingotp]=useState(false); - const [user,setUser]=useState(""); - const [password,setPassword]=useState(""); - const [otp,setOTP]=useState(""); - const [message,setMessage]=useState(""); - const [sevstatus,setsevstatus]=useState("success"); - const [OpenedSnack,SetOpen]=useState(false); - const [loadingsignup,SetLoader]=useState(false); - const [finalpass,setFinal]=useState(""); - const { - register:registerUser, - handleSubmit:handleSubmitUser, - formState: { errors } - } = useForm(); - const { - register: registerOTP, - handleSubmit: handleSubmitOTP, - getValues:gettervalues, - formState: { errors: errorsOTP }, - } = useForm(); - const sendUser = async (data: SignUpStudentParams) => { - data.user_id=user; - data.password=password; - data.user_otp=otp; - setloadingotp(true); - const response = await studentSignUpRequest.post(data); - setsevstatus(response.request.status==200?"success":"error") - setMessage(response.request.status==200?response.data.status:"Wrong credentials"); - SetOpen(true); - setloadingotp(false); - if(response.request.status==200){ - window.location.href="/auth/login"; - } - }; - const sendOTP = async (data: OTPParams) => { - data.user_id=user; - SetLoader(true); - const response = await otpRequest.post(data); - setsevstatus(response.request.status==200?"success":"error") - setMessage(response.request.status==200?response.data.status:response.message); - otpstage(response.request.status!=200); - SetOpen(true); - SetLoader(false); - }; - return ( - <> -
-
-
-
-
-

Sign Up

-
-
-
-
-
- {isOTP?<> -
-
- - (); + + const { + register: registerOTP, + handleSubmit: handleSubmitOTP, + formState: { errors: errorsOTP }, + } = useForm(); + + const [emailStatus, setEmailStatus] = useState(false); + const [values, setValues] = useState({ + showPassword: false, + showConfirmPassword: false, + }); + const [loading, setLoading] = useState(false); + const router = useRouter(); + + const handleSignUp = async (data: SignUpStudentParams) => { + data.role_id = 100; + setLoading(true); + const response = await studentSignUpRequest.post(data); + if (response) { + router.push("/auth/login"); + } + setLoading(false); + }; + + const handleClickShowPassword = (pass: string) => { + if (pass === "password") { + setValues({ + ...values, + showPassword: !values.showPassword, + }); + } else { + setValues({ + ...values, + showConfirmPassword: !values.showConfirmPassword, + }); + } + }; + + const handleMouseDownPassword = ( + event: React.MouseEvent + ) => { + event.preventDefault(); + }; + + const handleEmailOtpSubmit = async (data: OTPParams) => { + setValue("email", data.email); + setLoading(true); + const response = await otpRequest.post(data); + console.log(response) + setEmailStatus(response); + setLoading(false); + }; + + const capitalizeFirstLetter = (str: string) => + str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); + + const titleCase = (str: string) => { + const escapedStr = str.replace(/\s\s+/g, " "); + const splitStr = escapedStr + .trim() + .toLowerCase() + .split(" ") + .map(capitalizeFirstLetter); + return splitStr.join(" "); + }; + + return ( +
+ + + titleCase(value), + })} + error={!!errors.name} + helperText={errors.name ? "Name is required!" : ""} + /> + + + + value.trim().toLowerCase(), - })} id="user_id" onChange={(event)=>{setUser(event.currentTarget.value)}} disabled={!isOTP} className="appearance-none block w-full bg-gray-200 text-gray-700 border rounded py-3 px-4 mb-0 leading-tight focus:outline-none focus:bg-white" type="email" placeholder="mahirj23@iitk.ac.in" /> - {errorsOTP.user_id?Invalid IITK Email ID:<>} -
-
-
-
- - {setPassword(event.currentTarget.value)}} disabled={!isOTP} className="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white focus:border-gray-500" type="password" placeholder="******************" /> - {errorsOTP.password && ( -

Incorrect Password

- )} -
-
-
-
- - value === gettervalues("password"), - }, - })} id="confirm-password" disabled={!isOTP} className="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white focus:border-gray-500" type="password" placeholder="******************" /> - {errorsOTP.confirm_password && ( -

Passwords do not match

- )} -
-
- :<> -
-
- - {setOTP(event.currentTarget.value)}} className="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white focus:border-gray-500" type="text" value={otp} placeholder="123456" /> - {errors.user_otp && ( -

Enter OTP

+ })} + error={!!errorsOTP.email} + helperText={errorsOTP.email ? "Invalid IITK Email ID" : ""} + /> + + + {!emailStatus && ( + + + Next + + )} + + + }> + + + + An OTP has been sent to your <cc_id>@iitk.ac.in + + { + return parseInt(otp) + } + })} + disabled={!emailStatus} + error={!!errors.otp} + helperText={errors.otp ? "OTP is required!" : ""} + > + + + + Password + + + handleClickShowPassword("password")} + onMouseDown={handleMouseDownPassword} + edge="end" + > + {values.showPassword ? ( + + ) : ( + + )} + + + } + label="Password" + /> + {errors.password && ( + + Incorrect password + + )} + + + + Confirm Password + + + value === getValues("password"), + }, + })} + endAdornment={ + + + handleClickShowPassword("confirmPassword") + } + onMouseDown={handleMouseDownPassword} + edge="end" + > + {values.showConfirmPassword ? ( + + ) : ( + + )} + + + } + label="Confirm Password" + /> + {errors.confirm_password && ( + + Passwords don't match + + )} + + + + Sign Up + + + + + + + + Already have an account?{" "} + + Sign In + + + +
-
- } -
- {isOTP?<> - - Sign Up - - :<> - - Confirm - - {otpstage(true);SetLoader(false);setloadingotp(false);}} className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" type="button"> - Change User Id - - } - - Sign In - -
- -
-
-
-
- {SetOpen(false)}} - > - {SetOpen(false)}} - severity={sevstatus} - variant="filled" - sx={{ width: '100%' }} - > - {message} - - - - ) -} \ No newline at end of file + ); +} + +export default SignUpStudent; diff --git a/callbacks/auth/student/login.ts b/callbacks/auth/student/login.ts index 9a11f57..6a82832 100644 --- a/callbacks/auth/student/login.ts +++ b/callbacks/auth/student/login.ts @@ -5,15 +5,15 @@ import { SERVER_ERROR, StatusResponse,responseBody } from "../../constants"; +import { errorNotification } from "@/callbacks/notification"; export interface LoginStudentParams { - user_id: string; + email: string; password:string; remember_me:boolean; } export interface LoginResponse { token: string; role_id: number; - user_id: string; } const authInstance = axios.create({ baseURL: STUDENT_AUTH_URL, @@ -28,9 +28,11 @@ const studentLoginRequest = { LoginResponse, AxiosResponse, LoginStudentParams - >("/api/auth/login", body) + >("/api/auth/user/login", body) .then(responseBody) .catch((err: ErrorType) => { + console.log("Login Failed") + errorNotification("Login Failed", err.response?.data?.error) return { user_id: "", token: "", role_id: 0 } as LoginResponse; }), }; diff --git a/callbacks/auth/student/otp.ts b/callbacks/auth/student/otp.ts index 4b492e6..e941509 100644 --- a/callbacks/auth/student/otp.ts +++ b/callbacks/auth/student/otp.ts @@ -8,9 +8,7 @@ import { import { errorNotification, pushNotification } from "../../notification"; export interface OTPParams { - user_id: string; - password:string; - confirm_password:string; + email: string; } const authInstance = axios.create({ baseURL: STUDENT_AUTH_URL, @@ -27,10 +25,12 @@ const otpRequest = { AxiosResponse, OTPParams>("/api/auth/otp", body) .then((res) => { - return res; + pushNotification("OTP Sent!", res.data.status); + return true; }) .catch((err: ErrorType) => { - return err; + errorNotification("OTP request failed", err.response?.data?.error) + return false; }), }; diff --git a/callbacks/auth/student/signup.ts b/callbacks/auth/student/signup.ts index 5a341d4..7b1eac6 100644 --- a/callbacks/auth/student/signup.ts +++ b/callbacks/auth/student/signup.ts @@ -6,15 +6,17 @@ import { StatusResponse, } from "../../constants"; export interface SignUpStudentParams { - user_id: string; - password:string; - confirm_password:string; - user_otp:string; + name: string; + email: string; + password: string; + confirm_password: string; + role_id: number; + otp: number; } const authInstance = axios.create({ baseURL: STUDENT_AUTH_URL, timeout: 15000, - withCredentials:true, + withCredentials: true, timeoutErrorMessage: SERVER_ERROR, }); const studentSignUpRequest = { @@ -24,7 +26,7 @@ const studentSignUpRequest = { StatusResponse, AxiosResponse, SignUpStudentParams - >("/api/auth/signup", body) + >("/api/auth/user/create", body) .then((res) => { return res; }) @@ -32,4 +34,4 @@ const studentSignUpRequest = { return err; }), }; -export default studentSignUpRequest; \ No newline at end of file +export default studentSignUpRequest; diff --git a/callbacks/constants.ts b/callbacks/constants.ts index cfcde14..dd484bc 100644 --- a/callbacks/constants.ts +++ b/callbacks/constants.ts @@ -1,5 +1,5 @@ import { AxiosError, AxiosResponse } from "axios"; -export const STUDENT_AUTH_URL = `http://localhost:8087`; +export const STUDENT_AUTH_URL = `http://localhost:3000`; export const ADMIN_PROJECT_URL = `http://localhost:3492`; export const SERVER_ERROR = "Aw, Snap! Server maybe down."; diff --git a/package-lock.json b/package-lock.json index 4f7f233..790cd87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -260,17 +260,27 @@ } }, "node_modules/@emotion/cache": { - "version": "11.11.0", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.11.0.tgz", - "integrity": "sha512-P34z9ssTCBi3e9EI1ZsWpNHcfY1r09ZO0rZbRO2ob3ZQMnFI35jB536qoXbkdesr5EUhYi22anuEJuyxifaqAQ==", - "dependencies": { - "@emotion/memoize": "^0.8.1", - "@emotion/sheet": "^1.2.2", - "@emotion/utils": "^1.2.1", - "@emotion/weak-memoize": "^0.3.1", + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.14.0.tgz", + "integrity": "sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA==", + "dependencies": { + "@emotion/memoize": "^0.9.0", + "@emotion/sheet": "^1.4.0", + "@emotion/utils": "^1.4.2", + "@emotion/weak-memoize": "^0.4.0", "stylis": "4.2.0" } }, + "node_modules/@emotion/cache/node_modules/@emotion/memoize": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.9.0.tgz", + "integrity": "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==" + }, + "node_modules/@emotion/cache/node_modules/@emotion/weak-memoize": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz", + "integrity": "sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==" + }, "node_modules/@emotion/hash": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.1.tgz", @@ -325,9 +335,9 @@ } }, "node_modules/@emotion/sheet": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.2.tgz", - "integrity": "sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA==" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.4.0.tgz", + "integrity": "sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg==" }, "node_modules/@emotion/styled": { "version": "11.11.5", @@ -365,9 +375,9 @@ } }, "node_modules/@emotion/utils": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.2.1.tgz", - "integrity": "sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==" + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.4.2.tgz", + "integrity": "sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA==" }, "node_modules/@emotion/weak-memoize": { "version": "0.3.1", @@ -814,14 +824,14 @@ } }, "node_modules/@mui/base": { - "version": "5.0.0-beta.40", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.40.tgz", - "integrity": "sha512-I/lGHztkCzvwlXpjD2+SNmvNQvB4227xBXhISPjEaJUXGImOQ9f3D2Yj/T3KasSI/h0MLWy74X0J6clhPmsRbQ==", + "version": "5.0.0-beta.40-0", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.40-0.tgz", + "integrity": "sha512-hG3atoDUxlvEy+0mqdMpWd04wca8HKr2IHjW/fAjlkCHQolSLazhZM46vnHjOf15M4ESu25mV/3PgjczyjVM4w==", "dependencies": { "@babel/runtime": "^7.23.9", "@floating-ui/react-dom": "^2.0.8", - "@mui/types": "^7.2.14", - "@mui/utils": "^5.15.14", + "@mui/types": "^7.2.15", + "@mui/utils": "^5.16.12", "@popperjs/core": "^2.11.8", "clsx": "^2.1.0", "prop-types": "^15.8.1" @@ -834,9 +844,9 @@ "url": "https://opencollective.com/mui-org" }, "peerDependencies": { - "@types/react": "^17.0.0 || ^18.0.0", - "react": "^17.0.0 || ^18.0.0", - "react-dom": "^17.0.0 || ^18.0.0" + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -845,18 +855,18 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.16.0.tgz", - "integrity": "sha512-8SLffXYPRVpcZx5QzxNE8fytTqzp+IuU3deZbQWg/vSaTlDpR5YVrQ4qQtXTi5cRdhOufV5INylmwlKK+//nPw==", + "version": "5.16.12", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.16.12.tgz", + "integrity": "sha512-rkN+bPpe2Xn8h4ZLqKy5JsZt3nzMyTJ2ySdyLHHf0IL+PrxS46dxOIC1i66R8qi14kJBHfy7Byqv1yUvpwf0iw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui-org" } }, "node_modules/@mui/icons-material": { - "version": "5.15.21", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.15.21.tgz", - "integrity": "sha512-yqkq1MbdkmX5ZHyvZTBuAaA6RkvoqkoAgwBSx9Oh0L0jAfj9T/Ih/NhMNjkl8PWVSonjfDUkKroBnjRyo/1M9Q==", + "version": "5.16.12", + "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.16.12.tgz", + "integrity": "sha512-4Ocmbl1uzkWxAdYYARCLySJNqALgrJ+Fdr95FLpKZV7zMZxyoJRdPTO/CgUxjFjlj9Sy2Gi7j3HX4f5HS2GLeQ==", "dependencies": { "@babel/runtime": "^7.23.9" }, @@ -869,8 +879,8 @@ }, "peerDependencies": { "@mui/material": "^5.0.0", - "@types/react": "^17.0.0 || ^18.0.0", - "react": "^17.0.0 || ^18.0.0" + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -879,15 +889,15 @@ } }, "node_modules/@mui/lab": { - "version": "5.0.0-alpha.171", - "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-5.0.0-alpha.171.tgz", - "integrity": "sha512-/ZRnx0wB7hWHMsy76AAUJREVHZ7v5kOKwgJKCQrqOcaPNyo3WiwtTqKaM4Pgj+2r7O10IrC6zOniq8kTRqVAlA==", + "version": "5.0.0-alpha.175", + "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-5.0.0-alpha.175.tgz", + "integrity": "sha512-AvM0Nvnnj7vHc9+pkkQkoE1i+dEbr6gsMdnSfy7X4w3Ljgcj1yrjZhIt3jGTCLzyKVLa6uve5eLluOcGkvMqUA==", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/base": "5.0.0-beta.40", - "@mui/system": "^5.16.0", - "@mui/types": "^7.2.14", - "@mui/utils": "^5.16.0", + "@mui/base": "5.0.0-beta.40-0", + "@mui/system": "^5.16.12", + "@mui/types": "^7.2.15", + "@mui/utils": "^5.16.12", "clsx": "^2.1.0", "prop-types": "^15.8.1" }, @@ -902,9 +912,9 @@ "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", "@mui/material": ">=5.15.0", - "@types/react": "^17.0.0 || ^18.0.0", - "react": "^17.0.0 || ^18.0.0", - "react-dom": "^17.0.0 || ^18.0.0" + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@emotion/react": { @@ -919,21 +929,21 @@ } }, "node_modules/@mui/material": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.16.0.tgz", - "integrity": "sha512-DbR1NckTLpjt9Zut9EGQ70th86HfN0BYQgyYro6aXQrNfjzSwe3BJS1AyBQ5mJ7TdL6YVRqohfukxj9JlqZZUg==", + "version": "5.16.12", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.16.12.tgz", + "integrity": "sha512-+M0UPy0xa9xGo8TV1vp9Mmf85TNUqpk7OoSiw+BaZf3D584S3aqfl+CL+EBTt9t52A97GnCjVNvXTO7hmLqhHw==", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/base": "5.0.0-beta.40", - "@mui/core-downloads-tracker": "^5.16.0", - "@mui/system": "^5.16.0", - "@mui/types": "^7.2.14", - "@mui/utils": "^5.16.0", + "@mui/core-downloads-tracker": "^5.16.12", + "@mui/system": "^5.16.12", + "@mui/types": "^7.2.15", + "@mui/utils": "^5.16.12", + "@popperjs/core": "^2.11.8", "@types/react-transition-group": "^4.4.10", "clsx": "^2.1.0", "csstype": "^3.1.3", "prop-types": "^15.8.1", - "react-is": "^18.2.0", + "react-is": "^19.0.0", "react-transition-group": "^4.4.5" }, "engines": { @@ -946,9 +956,9 @@ "peerDependencies": { "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", - "@types/react": "^17.0.0 || ^18.0.0", - "react": "^17.0.0 || ^18.0.0", - "react-dom": "^17.0.0 || ^18.0.0" + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@emotion/react": { @@ -997,12 +1007,12 @@ } }, "node_modules/@mui/private-theming": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.16.0.tgz", - "integrity": "sha512-sYpubkO1MZOnxNyVOClrPNOTs0MfuRVVnAvCeMaOaXt6GimgQbnUcshYv2pSr6PFj+Mqzdff/FYOBceK8u5QgA==", + "version": "5.16.12", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.16.12.tgz", + "integrity": "sha512-hhLTSZxsazwZZ4bUAKgFcbsnfCrwizSnJI7/bXf/R9/tZkZBy+bKY05/Au/bIgGKzuZ4KTlKlPn+U/uufEXrNw==", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/utils": "^5.16.0", + "@mui/utils": "^5.16.12", "prop-types": "^15.8.1" }, "engines": { @@ -1013,8 +1023,8 @@ "url": "https://opencollective.com/mui-org" }, "peerDependencies": { - "@types/react": "^17.0.0 || ^18.0.0", - "react": "^17.0.0 || ^18.0.0" + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -1023,12 +1033,12 @@ } }, "node_modules/@mui/styled-engine": { - "version": "5.15.14", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.15.14.tgz", - "integrity": "sha512-RILkuVD8gY6PvjZjqnWhz8fu68dVkqhM5+jYWfB5yhlSQKg+2rHkmEwm75XIeAqI3qwOndK6zELK5H6Zxn4NHw==", + "version": "5.16.12", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.16.12.tgz", + "integrity": "sha512-TMf3SN19rkJPh1hQZTjoY8UsJa5qExfr78owwCuEZLjIhsajAYiWmbJzJ8mM3grEWLiP3MziDA4zy4LFNri12Q==", "dependencies": { "@babel/runtime": "^7.23.9", - "@emotion/cache": "^11.11.0", + "@emotion/cache": "^11.13.5", "csstype": "^3.1.3", "prop-types": "^15.8.1" }, @@ -1042,7 +1052,7 @@ "peerDependencies": { "@emotion/react": "^11.4.1", "@emotion/styled": "^11.3.0", - "react": "^17.0.0 || ^18.0.0" + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@emotion/react": { @@ -1054,15 +1064,15 @@ } }, "node_modules/@mui/system": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.16.0.tgz", - "integrity": "sha512-9YbkC2m3+pNumAvubYv+ijLtog6puJ0fJ6rYfzfLCM47pWrw3m+30nXNM8zMgDaKL6vpfWJcCXm+LPaWBpy7sw==", + "version": "5.16.12", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.16.12.tgz", + "integrity": "sha512-rDsndVl0ug0Ex2rZt8x0WIF3Zc0EMFT2TmRVWP4jzk38aLS6WsxryXAZUQa0BKEnB3vfx1pSP/xa44TdKQ94dg==", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/private-theming": "^5.16.0", - "@mui/styled-engine": "^5.15.14", - "@mui/types": "^7.2.14", - "@mui/utils": "^5.16.0", + "@mui/private-theming": "^5.16.12", + "@mui/styled-engine": "^5.16.12", + "@mui/types": "^7.2.15", + "@mui/utils": "^5.16.12", "clsx": "^2.1.0", "csstype": "^3.1.3", "prop-types": "^15.8.1" @@ -1077,8 +1087,8 @@ "peerDependencies": { "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", - "@types/react": "^17.0.0 || ^18.0.0", - "react": "^17.0.0 || ^18.0.0" + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@emotion/react": { @@ -1093,11 +1103,11 @@ } }, "node_modules/@mui/types": { - "version": "7.2.14", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.14.tgz", - "integrity": "sha512-MZsBZ4q4HfzBsywtXgM1Ksj6HDThtiwmOKUXH1pKYISI9gAVXCNHNpo7TlGoGrBaYWZTdNoirIN7JsQcQUjmQQ==", + "version": "7.2.20", + "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.20.tgz", + "integrity": "sha512-straFHD7L8v05l/N5vcWk+y7eL9JF0C2mtph/y4BPm3gn2Eh61dDwDB65pa8DLss3WJfDXYC7Kx5yjP0EmXpgw==", "peerDependencies": { - "@types/react": "^17.0.0 || ^18.0.0" + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -1106,14 +1116,16 @@ } }, "node_modules/@mui/utils": { - "version": "5.16.0", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.16.0.tgz", - "integrity": "sha512-kLLi5J1xY+mwtUlMb8Ubdxf4qFAA1+U7WPBvjM/qQ4CIwLCohNb0sHo1oYPufjSIH/Z9+dhVxD7dJlfGjd1AVA==", + "version": "5.16.12", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.16.12.tgz", + "integrity": "sha512-p3JAq7nA0ur8M/zLnBvR6ZeAjM8mD4LnPdKfsJAYPS26w4eDQjQzl55XvoOmch2MeXhmWaO4Pkvs/xurrISNBw==", "dependencies": { "@babel/runtime": "^7.23.9", - "@types/prop-types": "^15.7.11", + "@mui/types": "^7.2.15", + "@types/prop-types": "^15.7.12", + "clsx": "^2.1.1", "prop-types": "^15.8.1", - "react-is": "^18.2.0" + "react-is": "^19.0.0" }, "engines": { "node": ">=12.0.0" @@ -1123,8 +1135,8 @@ "url": "https://opencollective.com/mui-org" }, "peerDependencies": { - "@types/react": "^17.0.0 || ^18.0.0", - "react": "^17.0.0 || ^18.0.0" + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -3968,10 +3980,10 @@ } }, "node_modules/@types/react-transition-group": { - "version": "4.4.10", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.10.tgz", - "integrity": "sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q==", - "dependencies": { + "version": "4.4.12", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.12.tgz", + "integrity": "sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==", + "peerDependencies": { "@types/react": "*" } }, @@ -8314,9 +8326,9 @@ } }, "node_modules/react-is": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", - "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==" + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.0.0.tgz", + "integrity": "sha512-H91OHcwjZsbq3ClIDHMzBShc1rotbfACdWENsmEf0IFvZ3FgGPtdHMcsv45bQ1hAbgdfiA8SnxTKfDS+x/8m2g==" }, "node_modules/react-leaflet": { "version": "4.2.1", diff --git a/store/store.tsx b/store/store.tsx index 5191465..ed9a830 100644 --- a/store/store.tsx +++ b/store/store.tsx @@ -6,14 +6,10 @@ interface StateType { role: number; token: string; userID: string; - rcId: number; - rcName: string; name: string; setRole: (role: number) => void; setToken: (token: string) => void; setUserID: (user_id: string) => void; - setRcId: (rcId: number) => void; - setRCName: (rcName: string) => void; setName: (name: string) => void; } @@ -22,10 +18,6 @@ const useStore = create()( (set, get) => ({ role: 0 || get()?.role, setRole: (role: number) => set({ role }), - rcId: 0 || get()?.rcId, - setRcId: (rcId: number) => set({ rcId }), - rcName: "" || get()?.rcName, - setRCName: (rcName: string) => set({ rcName }), userID: "" || get()?.userID, setUserID: (userID: string) => set({ userID }), token: "" || get()?.token,