Commit 687cbc93 by Arjun Jhukal

redrection after login at admin fixed

parent ff25bf81
...@@ -77,7 +77,8 @@ export default function LoginPage() { ...@@ -77,7 +77,8 @@ export default function LoginPage() {
secure: process.env.NODE_ENV === 'production', secure: process.env.NODE_ENV === 'production',
sameSite: 'Strict', sameSite: 'Strict',
}); });
router.replace("/credentials"); console.log("Login Response:", response?.data?.user?.role.toLowerCase() === "admin");
router.replace(response?.data?.user?.role?.toLowerCase() === "admin" ? "/" : "/credentials");
} }
catch (e: any) { catch (e: any) {
dispatch( dispatch(
......
...@@ -109,7 +109,6 @@ import { useFormik } from 'formik'; ...@@ -109,7 +109,6 @@ import { useFormik } from 'formik';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
import Script from 'next/script'; import Script from 'next/script';
import { useState } from 'react'; import { useState } from 'react';
import * as Yup from 'yup';
import { PaymentModeProps } from '.'; import { PaymentModeProps } from '.';
declare global { declare global {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment