✨ Fixing login
This commit is contained in:
parent
78cd1ec0b3
commit
7cbd73c048
@ -1,18 +1,33 @@
|
||||
import CoffreIcon from "@Assets/Icons/coffre.svg";
|
||||
// import { FrontendVariables } from "@Front/Config/VariablesFront";
|
||||
import idNoteLogo from "@Assets/Icons/id-note-logo.svg";
|
||||
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
||||
import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage";
|
||||
import Module from "@Front/Config/Module";
|
||||
import JwtService from "@Front/Services/JwtService/JwtService";
|
||||
import UserStore from "@Front/Stores/UserStore";
|
||||
import Image from "next/image";
|
||||
import { useRouter } from "next/router";
|
||||
import { useCallback } from "react";
|
||||
|
||||
import BasePage from "../Base";
|
||||
import classes from "./classes.module.scss";
|
||||
import LandingImage from "./landing-connect.jpeg";
|
||||
|
||||
export default class LoginClass extends BasePage {
|
||||
public override render(): JSX.Element {
|
||||
export default function Login() {
|
||||
const router = useRouter();
|
||||
const redirectUserOnConnection = useCallback(() => {
|
||||
async function getUser() {
|
||||
try {
|
||||
await UserStore.instance.connect(process.env["NEXT_PUBLIC_ADMIN_ID"] as string);
|
||||
await JwtService.getInstance().checkJwt();
|
||||
router.push(Module.getInstance().get().modules.pages.Folder.props.path);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
getUser();
|
||||
}, [router]);
|
||||
return (
|
||||
<DefaultDoubleSidePage title={"Login"} image={LandingImage}>
|
||||
<div className={classes["root"]}>
|
||||
@ -20,7 +35,7 @@ export default class LoginClass extends BasePage {
|
||||
<Typography typo={ITypo.H1}>
|
||||
<div className={classes["title"]}>Connexion espace professionnel</div>
|
||||
</Typography>
|
||||
<Button onClick={this.redirectUserOnConnection} icon={idNoteLogo} iconposition={"left"}>
|
||||
<Button onClick={redirectUserOnConnection} icon={idNoteLogo} iconposition={"left"}>
|
||||
S'identifier avec ID.not
|
||||
</Button>
|
||||
<Typography typo={ITypo.P_18}>
|
||||
@ -31,18 +46,3 @@ export default class LoginClass extends BasePage {
|
||||
</DefaultDoubleSidePage>
|
||||
);
|
||||
}
|
||||
|
||||
private async redirectUserOnConnection() {
|
||||
// const variables = FrontendVariables.getInstance();
|
||||
// const baseFronturl = variables.BACK_API_PROTOCOL + variables.FRONT_APP_HOST;
|
||||
|
||||
await UserStore.instance.connect(process.env["NEXT_PUBLIC_ADMIN_ID"] as string);
|
||||
// await JwtService.getInstance().checkJwt();
|
||||
// window.location.assign("http://localhost:3000" + "/folders");
|
||||
|
||||
// const authorizeEndPoint = variables.IDNOT_AUTHORIZE_ENDPOINT;
|
||||
// const clientId = variables.IDNOT_CLIENT_ID;
|
||||
// const url = `${authorizeEndPoint}?client_id=${clientId}&redirect_uri=${baseFronturl}/authorized-client&scope=openid,profile,offline_access&response_type=code`;
|
||||
// window.location.assign(url);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user