From 77c0077638ed01c2ce3ec8666ebd950ec9906f60 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Tue, 11 Jul 2023 11:52:12 +0330 Subject: [PATCH 01/13] edit_sidebar --- src/core/data/sidebarMenu.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index 40f08c8..cf2aacb 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -47,12 +47,12 @@ const sidebarMenu = [ role: "transportation-assistance", }, { - key: "sidebar.master", + key: "sidebar.manager", type: "page", - route: "/dashboard/master", + route: "/dashboard/manager", icon: , selected: false, - role: "master", + role: "manager", }, ], ]; From 8419294277694e652971310ad86bf79f2b13c1fe Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Tue, 11 Jul 2023 12:02:44 +0330 Subject: [PATCH 02/13] edit side bar data --- public/locales/fa/app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 09654eb..95ac1eb 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -22,7 +22,7 @@ "machinary-office": "ماشین آلات", "passenger-boss": "رئیس مسافر", "transportation-assistance": "معاونت حمل و نقل", - "master": "مدیر کل" + "manager": "مدیر کل" }, "Authorization": { "typography_your_login_is_valid_and_you_do_not_need_to_login_again": "شما دسترسی لازم به این صفحه را دارید نیاز به ورود مجدد نیست.", From a3e7bc72373584c2a7ccf43867385bcb5f46e35c Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Tue, 11 Jul 2023 14:58:44 +0330 Subject: [PATCH 03/13] implement change passwo --- public/locales/fa/app.json | 20 +- .../dashboard/change-password/index.jsx | 184 ++++++++++++++++++ src/core/data/apiRoutes.js | 6 + src/pages/dashboard/change-password/index.jsx | 23 +++ 4 files changed, 231 insertions(+), 2 deletions(-) create mode 100644 src/components/dashboard/change-password/index.jsx create mode 100644 src/pages/dashboard/change-password/index.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 95ac1eb..192ba78 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -22,7 +22,8 @@ "machinary-office": "ماشین آلات", "passenger-boss": "رئیس مسافر", "transportation-assistance": "معاونت حمل و نقل", - "manager": "مدیر کل" + "manager": "مدیر کل", + "change-password": "تغییر رمز عبور" }, "Authorization": { "typography_your_login_is_valid_and_you_do_not_need_to_login_again": "شما دسترسی لازم به این صفحه را دارید نیاز به ورود مجدد نیست.", @@ -43,9 +44,24 @@ "error_message_required": "اجباری!" }, "Dashboard": { - "dashboard_page": "داشبورد" + "dashboard_page": "داشبورد", + "change_password": "تغییر رمز عبور" }, "MuiDatePicker": { "date_picker_birthday": "تاریخ" + }, + "ChangePassword": { + "typography_change_password": "تغییر رمز عبور", + "label_current_password": "رمز عبور فعلی", + "label_new_password": "رمز عبور جدید", + "label_confirm_password": "تکرار رمز عبور جدید", + "error_message_required": "اجباری !", + "error_message_password_length": "رمز عبور باید حداقل 8 کاراکتر باشد.", + "error_message_password_match": "پسورد ها یکسان هستند", + "error_message_password_not_match": "پسورد و تکرار رمز عبور باید یکسان باشد" + }, + "SubmitButton": { + "button_while_submit": "در حال ثبت", + "button_submit": "ثبت" } } diff --git a/src/components/dashboard/change-password/index.jsx b/src/components/dashboard/change-password/index.jsx new file mode 100644 index 0000000..62d6fe3 --- /dev/null +++ b/src/components/dashboard/change-password/index.jsx @@ -0,0 +1,184 @@ +import CenterLayout from "@/layouts/CenterLayout"; +import DashboardLayouts from "@/layouts/dashboardLayouts"; +import { + Button, + Typography, + Stack, + Paper, + Container, + Box, +} from "@mui/material"; +import Image from "next/image"; +import { Formik } from "formik"; +import * as Yup from "yup"; +import { useTranslations } from "next-intl"; +import PasswordField from "@/core/components/PasswordField"; +import StyledForm from "@/core/components/StyledForm"; +import { CHANGE_PASSWORD } from "@/core/data/apiRoutes"; +import useUser from "@/lib/app/hooks/useUser"; +import axios from "axios"; +import Notifications from "@/core/components/notifications"; +import useDirection from "@/lib/app/hooks/useDirection"; +import { toast } from "react-toastify"; + +const DashboardChangePasswordComponent = () => { + const t = useTranslations(); + const { token } = useUser(); + const { directionApp } = useDirection(); + + const handleSubmit = (values, { setSubmitting, resetForm }) => { + toast.dismiss(); + const pendingToast = toast("Pending...", { + position: directionApp === "ltr" ? "top-left" : "top-right", + autoClose: false, + closeOnClick: false, + draggable: false, + }); + axios + .post( + CHANGE_PASSWORD, + { + current_password: values.current_password, + new_password: values.new_password, + new_password_confirmation: values.new_password_confirmation, + }, + { + headers: { authorization: `Bearer ${token}` }, + } + ) + .then((response) => { + toast.dismiss(pendingToast); // Dismiss the pending toast notification + Notifications(directionApp, response, t); + resetForm(); + }) + .catch((error) => { + toast.dismiss(pendingToast); // Dismiss the pending toast notification + Notifications(directionApp, error.response, t); + }) + .finally(() => { + setSubmitting(false); // Set `setSubmitting` to false after the API request completes + }); + }; + const initialValues = { + current_password: "", + new_password: "", + new_password_confirmation: "", + }; + const validationSchema = Yup.object().shape({ + current_password: Yup.string().required( + t("ChangePassword.error_message_required") + ), + new_password: Yup.string() + .min(8, t("ChangePassword.error_message_password_length")) + .required(t("ChangePassword.error_message_required")), + new_password_confirmation: Yup.string() + .required(t("ChangePassword.error_message_required")) + .test( + t("ChangePassword.error_message_password_match"), + t("ChangePassword.error_message_password_not_match"), + function (value) { + return this.parent.new_password === value; + } + ), + }); + + return ( + + + + + {(props) => ( + { + e.preventDefault(); + props.handleSubmit(); + }} + > + + + + + + + {t("ChangePassword.typography_change_password")} + + + + + + + + + + + + + + + )} + + + + + ); +}; +export default DashboardChangePasswordComponent; diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index e69de29..0877232 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -0,0 +1,6 @@ +const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL; + +//change password +export const CHANGE_PASSWORD = + BASE_URL + "/dashboard/profile/change_password"; +//end change password \ No newline at end of file diff --git a/src/pages/dashboard/change-password/index.jsx b/src/pages/dashboard/change-password/index.jsx new file mode 100644 index 0000000..85660ff --- /dev/null +++ b/src/pages/dashboard/change-password/index.jsx @@ -0,0 +1,23 @@ +import DashboardChangePasswordComponent from "@/components/dashboard/change-password"; +import TitlePage from "@/core/components/TitlePage"; +import WithAuthMiddleware from "@/middlewares/WithoutAuth"; +import { parse } from "next-useragent"; + +export default function LoanFollowUp() { + return ( + + + + + ); +} + +export async function getServerSideProps({ req, locale }) { + const { isBot } = parse(req.headers["user-agent"]); + return { + props: { + messages: (await import(`&/locales/${locale}/app.json`)).default, + isBot, + }, + }; +} From c0220a114f5ac94f680c0450bddb022df6d230b4 Mon Sep 17 00:00:00 2001 From: Amin Ghasempoor Date: Tue, 11 Jul 2023 17:17:45 +0330 Subject: [PATCH 04/13] interaction with back --- src/components/login-expert/index.jsx | 38 ++++++++++---------- src/core/data/apiRoutes.js | 5 +++ src/pages/dashboard/loan-follow-up/index.jsx | 2 +- src/pages/dashboard/loan-request/index.jsx | 2 +- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/components/login-expert/index.jsx b/src/components/login-expert/index.jsx index 65b1e1c..bcc3b1a 100644 --- a/src/components/login-expert/index.jsx +++ b/src/components/login-expert/index.jsx @@ -2,7 +2,7 @@ import LinkRouting from "@/core/components/LinkRouting"; // import Notifications from "@/core/components/notifications"; import PasswordField from "@/core/components/PasswordField"; import StyledForm from "@/core/components/StyledForm"; -// import { GET_USER_TOKEN } from "@/core/data/apiRoutes"; +import { GET_USER_TOKEN } from "@/core/data/apiRoutes"; import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import useDirection from "@/lib/app/hooks/useDirection"; @@ -17,7 +17,7 @@ import { TextField, Typography, } from "@mui/material"; -// import axios from "axios"; +import axios from "axios"; import { Field, Formik } from "formik"; import { useTranslations } from "next-intl"; import Image from "next/image"; @@ -33,21 +33,23 @@ const LoginComponent = () => { const searchParams = useSearchParams(); const backUrlDecodedPath = searchParams.get("back_url"); - // formik properties - // const handleSubmit = async (values, props) => { - // await axios - // .post(GET_USER_TOKEN, { - // username: values.username, - // password: values.password, - // }) - // .then(function (response) { - // setToken(response.data.token); - // }) - // .catch(function (error) { - // Notifications(directionApp, error.response, t); - // props.setSubmitting(false); - // }); - // }; + //formik properties + const handleSubmit = async (values, props) => { + await axios + .post(GET_USER_TOKEN, { + username: values.username, + password: values.password, + }) + .then(function (response) { + console.log(response); + setToken(response.data.token); + }) + .catch(function (error) { + // Notifications(directionApp, error.response, t); + console.log(error); + props.setSubmitting(false); + }); + }; const initialValues = { username: "", password: "", @@ -64,7 +66,7 @@ const LoginComponent = () => { {(props) => ( diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index e69de29..2b4b463 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -0,0 +1,5 @@ +const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL; + +//login +export const GET_USER_TOKEN = BASE_URL + "/dashboard/login"; +//end login diff --git a/src/pages/dashboard/loan-follow-up/index.jsx b/src/pages/dashboard/loan-follow-up/index.jsx index fc299c4..6bab35f 100644 --- a/src/pages/dashboard/loan-follow-up/index.jsx +++ b/src/pages/dashboard/loan-follow-up/index.jsx @@ -6,7 +6,7 @@ import { parse } from "next-useragent"; export default function LoanFollowUp() { return ( - + ); diff --git a/src/pages/dashboard/loan-request/index.jsx b/src/pages/dashboard/loan-request/index.jsx index b76f172..ad64ce8 100644 --- a/src/pages/dashboard/loan-request/index.jsx +++ b/src/pages/dashboard/loan-request/index.jsx @@ -6,7 +6,7 @@ import { parse } from "next-useragent"; export default function LoanRequest() { return ( - + ); From a2b89204669a80812dbd1c44d7040ae9db9e02f3 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Wed, 12 Jul 2023 10:18:36 +0330 Subject: [PATCH 05/13] implrement profile --- public/locales/fa/app.json | 9 +- .../dashboard/edit-profile/index.jsx | 190 ++++++++++++++++++ src/core/components/AvatarUpload.jsx | 128 ++++++++++++ src/pages/dashboard/edit-profile/index.jsx | 23 +++ 4 files changed, 349 insertions(+), 1 deletion(-) create mode 100644 src/components/dashboard/edit-profile/index.jsx create mode 100644 src/core/components/AvatarUpload.jsx create mode 100644 src/pages/dashboard/edit-profile/index.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 192ba78..8334094 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -23,7 +23,8 @@ "passenger-boss": "رئیس مسافر", "transportation-assistance": "معاونت حمل و نقل", "manager": "مدیر کل", - "change-password": "تغییر رمز عبور" + "change-password": "تغییر رمز عبور", + "edit-profile": "ویرایش پروفایل" }, "Authorization": { "typography_your_login_is_valid_and_you_do_not_need_to_login_again": "شما دسترسی لازم به این صفحه را دارید نیاز به ورود مجدد نیست.", @@ -63,5 +64,11 @@ "SubmitButton": { "button_while_submit": "در حال ثبت", "button_submit": "ثبت" + }, + "UpdateProfile": { + "error_invalid_email": "ایمیل نامعتبر است", + "typography_edit_profile": "ویرایش پروفایل", + "text_field_email": "ایمیل", + "text_field_enter_your_password": "رمز عبور خود را وارد کنید" } } diff --git a/src/components/dashboard/edit-profile/index.jsx b/src/components/dashboard/edit-profile/index.jsx new file mode 100644 index 0000000..3dd5468 --- /dev/null +++ b/src/components/dashboard/edit-profile/index.jsx @@ -0,0 +1,190 @@ +import StyledForm from "@/core/components/StyledForm"; +import CenterLayout from "@/layouts/CenterLayout"; +import DashboardLayouts from "@/layouts/dashboardLayouts"; +import useUser from "@/lib/app/hooks/useUser"; +import { + Box, + Button, + Container, + Paper, + Stack, + TextField, + Typography, +} from "@mui/material"; +import * as Yup from "yup"; +import { Field, Formik } from "formik"; +import { useTranslations } from "next-intl"; +import AvatarUpload from "@/core/components/AvatarUpload"; +import axios from "axios"; +import { UPDATE_PROFILE, UPDATE_AVATAR } from "@/core/data/apiRoutes"; +import useDirection from "@/lib/app/hooks/useDirection"; +import Notifications from "@/core/components/notifications"; +import ImageResizer from "@/core/components/ImageConvertor"; + +const DashboardEditProfile = () => { + const t = useTranslations(); + const { user, token, getUser, changeUser } = useUser(); + const { directionApp } = useDirection(); + + const editAvatar = async (avatar) => { + try { + const formData = new FormData(); + + if (avatar != null) { + var resizedAvatar; + resizedAvatar = await ImageResizer(avatar); + formData.append("avatar", resizedAvatar); + } + + await axios.post(UPDATE_AVATAR, formData, { + headers: { + authorization: `Bearer ${token}`, + "Content-Type": "multipart/form-data", + }, + }); + } catch (error) { + Notifications(directionApp, error.response, t); + throw error; + } + }; + const handleSubmit = (values, { setSubmitting }) => { + // const formData = new FormData(); + // formData.append("email", values.expert_email); + + // if (values.change_avatar !== false) { + // editAvatar(values.expert_avatar) + // .then(() => { + // return axios.post(UPDATE_PROFILE, formData, { + // headers: { + // authorization: `Bearer ${token}`, + // "Content-Type": "multipart/form-data", + // }, + // }); + // }) + // .then((response) => { + // Notifications(directionApp, response, t); + // getUser((data) => { + // changeUser(data); + // }); + // }) + // .catch((error) => { + // Notifications(directionApp, error.response, t); + // }) + // .finally(() => { + // setSubmitting(false); + // }); + // } else { + // axios + // .post(UPDATE_PROFILE, formData, { + // headers: { + // authorization: `Bearer ${token}`, + // "Content-Type": "multipart/form-data", + // }, + // }) + // .then((response) => { + // Notifications(directionApp, response, t); + // getUser((data) => { + // changeUser(data); + // }); + // }) + // .catch((error) => { + // Notifications(directionApp, error.response, t); + // }) + // .finally(() => { + // setSubmitting(false); + // }); + // } + }; + const initialValues = { + expert_avatar: null, + expert_email: user.expert_email, + change_avatar: false, + }; + const validationSchema = Yup.object().shape({ + expert_email: Yup.string().email(t("UpdateProfile.error_invalid_email")), + }); + + return ( + + + + + {(props) => ( + { + e.preventDefault(); + props.handleSubmit(); + }} + > + + + + {t("UpdateProfile.typography_edit_profile")} + + + + + + + + + + + + )} + + + + + ); +}; + +export default DashboardEditProfile; diff --git a/src/core/components/AvatarUpload.jsx b/src/core/components/AvatarUpload.jsx new file mode 100644 index 0000000..e1ade5c --- /dev/null +++ b/src/core/components/AvatarUpload.jsx @@ -0,0 +1,128 @@ +import { Avatar, Box, TextField } from "@mui/material"; +import { useState } from "react"; +import DeleteIcon from "@mui/icons-material/Delete"; +import AddIcon from "@mui/icons-material/Add"; + +const AvatarUpload = ({ user, setFieldValue, valueAvatar, changeFlag }) => { + const [selectedImage, setSelectedImage] = useState(user.expert_avatar); + const [isHovered, setIsHovered] = useState(false); + + const handleImageChange = (event) => { + const newImage = event.target?.files?.[0]; + if (newImage) { + setSelectedImage(URL.createObjectURL(newImage)); + setFieldValue(valueAvatar, newImage); + setFieldValue(changeFlag, true); + } else { + setSelectedImage(""); + setFieldValue(valueAvatar, null); + } + }; + + const handleDeleteImage = () => { + setSelectedImage(""); + setFieldValue(valueAvatar, null); + setFieldValue(changeFlag, true); + }; + + const handleMouseEnter = () => { + setIsHovered(true); + }; + + const handleMouseLeave = () => { + setIsHovered(false); + }; + + return ( + + + + + {isHovered && ( + + {selectedImage ? ( + + ) : ( + + )} + + )} + + + + + ); +}; + +export default AvatarUpload; diff --git a/src/pages/dashboard/edit-profile/index.jsx b/src/pages/dashboard/edit-profile/index.jsx new file mode 100644 index 0000000..1cf3b5c --- /dev/null +++ b/src/pages/dashboard/edit-profile/index.jsx @@ -0,0 +1,23 @@ +import DashboardEditProfile from "@/components/dashboard/edit-profile"; +import TitlePage from "@/core/components/TitlePage"; +import WithAuthMiddleware from "@/middlewares/WithoutAuth"; +import { parse } from "next-useragent"; + +export default function LoanFollowUp() { + return ( + + + + + ); +} + +export async function getServerSideProps({ req, locale }) { + const { isBot } = parse(req.headers["user-agent"]); + return { + props: { + messages: (await import(`&/locales/${locale}/app.json`)).default, + isBot, + }, + }; +} From 08672c0a1ebcafb20fc6c292c3fad3fca8c8b8f5 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Wed, 12 Jul 2023 11:01:07 +0330 Subject: [PATCH 06/13] implement user profile --- .../dashboard/edit-profile/index.jsx | 142 +++++++++++++++--- 1 file changed, 117 insertions(+), 25 deletions(-) diff --git a/src/components/dashboard/edit-profile/index.jsx b/src/components/dashboard/edit-profile/index.jsx index 3dd5468..cfa16d7 100644 --- a/src/components/dashboard/edit-profile/index.jsx +++ b/src/components/dashboard/edit-profile/index.jsx @@ -6,6 +6,7 @@ import { Box, Button, Container, + Grid, Paper, Stack, TextField, @@ -50,7 +51,6 @@ const DashboardEditProfile = () => { const handleSubmit = (values, { setSubmitting }) => { // const formData = new FormData(); // formData.append("email", values.expert_email); - // if (values.change_avatar !== false) { // editAvatar(values.expert_avatar) // .then(() => { @@ -140,30 +140,122 @@ const DashboardEditProfile = () => { changeFlag="change_avatar" /> - - - + + + + + + + + + + + + + + + + + + + */} From f4bdf27098026fd508d7f5eb22ffb932e94725e0 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Wed, 12 Jul 2023 14:27:31 +0330 Subject: [PATCH 11/13] notifications transalte --- public/locales/fa/app.json | 20 ++++++++++++++----- .../dashboard/change-password/index.jsx | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index d3817af..eedee80 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -70,11 +70,21 @@ "typography_edit_profile": "ویرایش پروفایل", "text_field_email": "ایمیل", "text_field_enter_your_password": "رمز عبور خود را وارد کنید", - "text_field_username":"نام کاربری", - "text_field_name":"نام", - "text_field_phone_number":"شماره تماس", - "text_field_position":"سمت", - "text_field_province_name":"نام استان", + "text_field_username": "نام کاربری", + "text_field_name": "نام", + "text_field_phone_number": "شماره تماس", + "text_field_position": "سمت", + "text_field_province_name": "نام استان", "error_message_required": "اجباری !" + }, + "notifications": { + "code": "کد", + "error": "خطا", + "warning": "خطر", + "success": "موفق", + "error_static_text": "عملیات شما با خطا مواجه شد", + "warning_static_text": "خطا سرور", + "success_static_text": "عملیات شما با موفقیت انجام شد", + "pending":"در حال انجام..." } } diff --git a/src/components/dashboard/change-password/index.jsx b/src/components/dashboard/change-password/index.jsx index 62d6fe3..c2b5fd4 100644 --- a/src/components/dashboard/change-password/index.jsx +++ b/src/components/dashboard/change-password/index.jsx @@ -28,7 +28,7 @@ const DashboardChangePasswordComponent = () => { const handleSubmit = (values, { setSubmitting, resetForm }) => { toast.dismiss(); - const pendingToast = toast("Pending...", { + const pendingToast = toast(t("notifications.pending"), { position: directionApp === "ltr" ? "top-left" : "top-right", autoClose: false, closeOnClick: false, From 3ef3cd063eb4f8fa63d383b1524378009cbc5068 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Wed, 12 Jul 2023 14:40:02 +0330 Subject: [PATCH 12/13] debug site headers --- public/locales/fa/app.json | 5 +++-- src/pages/dashboard/edit-profile/index.jsx | 2 +- src/pages/dashboard/index.jsx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index eedee80..576727e 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -46,7 +46,8 @@ }, "Dashboard": { "dashboard_page": "داشبورد", - "change_password": "تغییر رمز عبور" + "change_password": "تغییر رمز عبور", + "edit_profile": "ویرایش پروفایل" }, "MuiDatePicker": { "date_picker_birthday": "تاریخ" @@ -85,6 +86,6 @@ "error_static_text": "عملیات شما با خطا مواجه شد", "warning_static_text": "خطا سرور", "success_static_text": "عملیات شما با موفقیت انجام شد", - "pending":"در حال انجام..." + "pending": "در حال انجام..." } } diff --git a/src/pages/dashboard/edit-profile/index.jsx b/src/pages/dashboard/edit-profile/index.jsx index aacdc40..0adabf6 100644 --- a/src/pages/dashboard/edit-profile/index.jsx +++ b/src/pages/dashboard/edit-profile/index.jsx @@ -6,7 +6,7 @@ import { parse } from "next-useragent"; export default function LoanFollowUp() { return ( - + ); diff --git a/src/pages/dashboard/index.jsx b/src/pages/dashboard/index.jsx index 57a801a..c3c3933 100644 --- a/src/pages/dashboard/index.jsx +++ b/src/pages/dashboard/index.jsx @@ -6,7 +6,7 @@ import { parse } from "next-useragent"; export default function Dashboard() { return ( - + ); From 9090da80d85c1b63ac26d283fdd7ea4fa51e80e8 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Wed, 12 Jul 2023 15:16:56 +0330 Subject: [PATCH 13/13] debug auth --- src/middlewares/WithAuth.jsx | 4 ++-- src/middlewares/WithoutAuth.jsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/middlewares/WithAuth.jsx b/src/middlewares/WithAuth.jsx index d158bf3..3fa5f43 100644 --- a/src/middlewares/WithAuth.jsx +++ b/src/middlewares/WithAuth.jsx @@ -16,7 +16,7 @@ const WithAuthMiddleware = ({ children }) => { text={ {t( - "typography_your_access_to_this_page_has_expired_Please_login_again" + "Authorization.typography_your_access_to_this_page_has_expired_Please_login_again" )} } @@ -26,7 +26,7 @@ const WithAuthMiddleware = ({ children }) => { variant="contained" component={NextLinkComposed} to={{ - pathname: "/login", + pathname: "/login-expert", query: { back_url: encodeURIComponent(router.asPath) }, }} > diff --git a/src/middlewares/WithoutAuth.jsx b/src/middlewares/WithoutAuth.jsx index 5fb4f93..cb8e571 100644 --- a/src/middlewares/WithoutAuth.jsx +++ b/src/middlewares/WithoutAuth.jsx @@ -37,14 +37,14 @@ const WithoutAuthMiddleware = ({ children }) => { {t( - "typography_your_login_is_valid_and_you_do_not_need_to_login_again" + "Authorization.typography_your_login_is_valid_and_you_do_not_need_to_login_again" )} - {t("typography_redirect_to")}{" "} + {t("Authorization.typography_redirect_to")}{" "} {backUrlDecodedPath - ? t("typography_routing_previuos_page") - : t("typography_routing_dashbaord_page")} + ? t("Authorization.typography_routing_previuos_page") + : t("Authorization.typography_routing_dashbaord_page")} }