Pull Request branch dev-clone to main #1
|
|
@ -16,6 +16,7 @@ import { Route as rootRoute } from './routes/__root'
|
|||
import { Route as VerifyingLayoutImport } from './routes/_verifyingLayout'
|
||||
import { Route as DashboardLayoutImport } from './routes/_dashboardLayout'
|
||||
import { Route as AssessmentLayoutImport } from './routes/_assessmentLayout'
|
||||
import { Route as LoginIndexImport } from './routes/login/index'
|
||||
import { Route as VerifyingLayoutVerifyingIndexImport } from './routes/_verifyingLayout/verifying/index'
|
||||
import { Route as DashboardLayoutUsersIndexImport } from './routes/_dashboardLayout/users/index'
|
||||
import { Route as DashboardLayoutTimetableIndexImport } from './routes/_dashboardLayout/timetable/index'
|
||||
|
|
@ -32,7 +33,6 @@ import { Route as AssessmentLayoutAssessmentIndexImport } from './routes/_assess
|
|||
const IndexLazyImport = createFileRoute('/')()
|
||||
const RegisterIndexLazyImport = createFileRoute('/register/')()
|
||||
const LogoutIndexLazyImport = createFileRoute('/logout/')()
|
||||
const LoginIndexLazyImport = createFileRoute('/login/')()
|
||||
const ForgotPasswordIndexLazyImport = createFileRoute('/forgot-password/')()
|
||||
const ForgotPasswordVerifyLazyImport = createFileRoute(
|
||||
'/forgot-password/verify',
|
||||
|
|
@ -72,11 +72,6 @@ const LogoutIndexLazyRoute = LogoutIndexLazyImport.update({
|
|||
getParentRoute: () => rootRoute,
|
||||
} as any).lazy(() => import('./routes/logout/index.lazy').then((d) => d.Route))
|
||||
|
||||
const LoginIndexLazyRoute = LoginIndexLazyImport.update({
|
||||
path: '/login/',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any).lazy(() => import('./routes/login/index.lazy').then((d) => d.Route))
|
||||
|
||||
const ForgotPasswordIndexLazyRoute = ForgotPasswordIndexLazyImport.update({
|
||||
path: '/forgot-password/',
|
||||
getParentRoute: () => rootRoute,
|
||||
|
|
@ -84,6 +79,11 @@ const ForgotPasswordIndexLazyRoute = ForgotPasswordIndexLazyImport.update({
|
|||
import('./routes/forgot-password/index.lazy').then((d) => d.Route),
|
||||
)
|
||||
|
||||
const LoginIndexRoute = LoginIndexImport.update({
|
||||
path: '/login/',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ForgotPasswordVerifyLazyRoute = ForgotPasswordVerifyLazyImport.update({
|
||||
path: '/forgot-password/verify',
|
||||
getParentRoute: () => rootRoute,
|
||||
|
|
@ -222,6 +222,13 @@ declare module '@tanstack/react-router' {
|
|||
preLoaderRoute: typeof ForgotPasswordVerifyLazyImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
'/login/': {
|
||||
id: '/login/'
|
||||
path: '/login'
|
||||
fullPath: '/login'
|
||||
preLoaderRoute: typeof LoginIndexImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
'/forgot-password/': {
|
||||
id: '/forgot-password/'
|
||||
path: '/forgot-password'
|
||||
|
|
@ -229,13 +236,6 @@ declare module '@tanstack/react-router' {
|
|||
preLoaderRoute: typeof ForgotPasswordIndexLazyImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
'/login/': {
|
||||
id: '/login/'
|
||||
path: '/login'
|
||||
fullPath: '/login'
|
||||
preLoaderRoute: typeof LoginIndexLazyImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
'/logout/': {
|
||||
id: '/logout/'
|
||||
path: '/logout'
|
||||
|
|
@ -344,8 +344,8 @@ export const routeTree = rootRoute.addChildren({
|
|||
VerifyingLayoutVerifyingIndexRoute,
|
||||
}),
|
||||
ForgotPasswordVerifyLazyRoute,
|
||||
LoginIndexRoute,
|
||||
ForgotPasswordIndexLazyRoute,
|
||||
LoginIndexLazyRoute,
|
||||
LogoutIndexLazyRoute,
|
||||
RegisterIndexLazyRoute,
|
||||
})
|
||||
|
|
@ -363,8 +363,8 @@ export const routeTree = rootRoute.addChildren({
|
|||
"/_dashboardLayout",
|
||||
"/_verifyingLayout",
|
||||
"/forgot-password/verify",
|
||||
"/forgot-password/",
|
||||
"/login/",
|
||||
"/forgot-password/",
|
||||
"/logout/",
|
||||
"/register/"
|
||||
]
|
||||
|
|
@ -400,12 +400,12 @@ export const routeTree = rootRoute.addChildren({
|
|||
"/forgot-password/verify": {
|
||||
"filePath": "forgot-password/verify.lazy.tsx"
|
||||
},
|
||||
"/login/": {
|
||||
"filePath": "login/index.tsx"
|
||||
},
|
||||
"/forgot-password/": {
|
||||
"filePath": "forgot-password/index.lazy.tsx"
|
||||
},
|
||||
"/login/": {
|
||||
"filePath": "login/index.lazy.tsx"
|
||||
},
|
||||
"/logout/": {
|
||||
"filePath": "logout/index.lazy.tsx"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,27 +1,17 @@
|
|||
import { createLazyFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { useEffect } from "react";
|
||||
import { createLazyFileRoute, Navigate } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createLazyFileRoute("/")({
|
||||
component: HomePage,
|
||||
});
|
||||
|
||||
export default function HomePage() {
|
||||
const navigate = useNavigate();
|
||||
const userRole = JSON.parse(localStorage.getItem('userRole') || '{}');
|
||||
const userRole = JSON.parse(localStorage.getItem("userRole") || "{}");
|
||||
|
||||
useEffect(() => {
|
||||
if (userRole === "super-admin") {
|
||||
navigate({
|
||||
to: "/users",
|
||||
replace: true,
|
||||
});
|
||||
} else if (userRole === "user") {
|
||||
navigate({
|
||||
to: "/assessmentRequest",
|
||||
replace: true,
|
||||
});
|
||||
}
|
||||
}, [navigate]);
|
||||
|
||||
return <div>index.lazy</div>;
|
||||
return userRole === "super-admin" ? (
|
||||
<Navigate to="/users" replace />
|
||||
) : userRole === "user" ? (
|
||||
<Navigate to="/assessmentRequest" replace />
|
||||
) : (
|
||||
<Navigate to="/login" replace />
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { createLazyFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { Input } from '@/shadcn/components/ui/input.tsx';
|
||||
import { Button } from '@/shadcn/components/ui/button.tsx';
|
||||
|
|
@ -21,7 +21,7 @@ import useAuth from "@/hooks/useAuth";
|
|||
import { TbArrowNarrowRight } from "react-icons/tb";
|
||||
import amatilogo from "@/assets/logos/amati-logo.png";
|
||||
|
||||
export const Route = createLazyFileRoute("/login/")({
|
||||
export const Route = createFileRoute("/login/")({
|
||||
component: LoginPage,
|
||||
});
|
||||
|
||||
|
|
@ -36,6 +36,7 @@ const formSchema = z.object({
|
|||
});
|
||||
|
||||
export default function LoginPage() {
|
||||
console.log("hii");
|
||||
const [errorMessage, setErrorMessage] = useState("");
|
||||
const navigate = useNavigate();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user