Sarting auth implementation in front
This commit is contained in:
14
gui/rpk-gui/src/pages/auth/Login.tsx
Normal file
14
gui/rpk-gui/src/pages/auth/Login.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
export const Login = () => {
|
||||
async function handleLogin(e: any) {
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={ handleLogin }>
|
||||
<input type={ "text" } name={ "email" } />
|
||||
<input type={ "password" } name={ "password" } />
|
||||
<input type={ "submit" } />
|
||||
</form>
|
||||
)
|
||||
}
|
||||
16
gui/rpk-gui/src/pages/auth/ProtectedRoute.tsx
Normal file
16
gui/rpk-gui/src/pages/auth/ProtectedRoute.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import {Navigate, Outlet} from "react-router";
|
||||
|
||||
type AuthUser = { id: string; name: string };
|
||||
|
||||
type ProtectedRouteProps = {
|
||||
user: AuthUser | null;
|
||||
redirectPath?: string;
|
||||
};
|
||||
|
||||
export const ProtectedRoute = ({ user, redirectPath = "/" }: ProtectedRouteProps) => {
|
||||
if (!user) {
|
||||
return <Navigate to={redirectPath} replace />;
|
||||
}
|
||||
|
||||
return <Outlet />;
|
||||
};
|
||||
15
gui/rpk-gui/src/pages/auth/Register.tsx
Normal file
15
gui/rpk-gui/src/pages/auth/Register.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
export const Register = () => {
|
||||
async function handleRegister(e: any) {
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={ handleRegister }>
|
||||
<input type={ "text" } name={ "email" } />
|
||||
<input type={ "password" } name={ "password" }/>
|
||||
<input type={ "password" } name={ "confirm_password" }/>
|
||||
<input type={ "submit" } />
|
||||
</form>
|
||||
)
|
||||
}
|
||||
7
gui/rpk-gui/src/pages/entities/List.tsx
Normal file
7
gui/rpk-gui/src/pages/entities/List.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
export const EntityList = () => {
|
||||
return (
|
||||
<h1>List des entity: Yoyoyo</h1>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user