Prefetch dashboard route on login page
All checks were successful
Build Frontend / build (push) Successful in 1m9s
All checks were successful
Build Frontend / build (push) Successful in 1m9s
Added useEffect to prefetch the /dashboard route when the login page loads, improving navigation speed after login.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import React, { Suspense, lazy } from "react";
|
import React, { Suspense, lazy, useEffect } from "react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
|
||||||
// Use lazy loading for the form component
|
// Use lazy loading for the form component
|
||||||
@@ -30,6 +31,12 @@ function LoginLoading() {
|
|||||||
|
|
||||||
// Main page component
|
// Main page component
|
||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
router.prefetch("/dashboard");
|
||||||
|
}, [router]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative flex items-center justify-center min-h-screen overflow-hidden">
|
<div className="relative flex items-center justify-center min-h-screen overflow-hidden">
|
||||||
<AuthBackground />
|
<AuthBackground />
|
||||||
|
|||||||
Reference in New Issue
Block a user