24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
import { Route, Routes, Navigate } from "react-router-dom";
|
|
import AuthLayout from "../layouts/AuthLayout.jsx";
|
|
import LoginForm from "../components/LoginForm.jsx";
|
|
import RegisterPage from "../pages/auth/RegisterPage.jsx";
|
|
|
|
|
|
export default function AuthRoutes() {
|
|
return(
|
|
<Routes>
|
|
{/* 1. Root Path ('/') นำทางไปยัง /login ทันที */}
|
|
<Route path="/" element={<Navigate to="/login" replace />} />
|
|
|
|
{/* 2. AuthLayout สำหรับหน้า Login, Register, Forgot Password */}
|
|
<Route element={<AuthLayout/>}>
|
|
<Route path="/login" element={<LoginForm/>}/>
|
|
<Route path="/register" element={<RegisterPage/>}/>
|
|
<Route path="/forgot-password" element={<div>หน้าลืมรหัสผ่าน</div>}/>
|
|
</Route>
|
|
|
|
{/* 3. Fallback สำหรับเส้นทางที่ไม่รู้จักในส่วน Public */}
|
|
<Route path="*" element={<div>404 Not Found</div>}/>
|
|
</Routes>
|
|
);
|
|
} |