✨ Fixing login
This commit is contained in:
parent
78cd1ec0b3
commit
7cbd73c048
@ -1,18 +1,33 @@
|
|||||||
import CoffreIcon from "@Assets/Icons/coffre.svg";
|
import CoffreIcon from "@Assets/Icons/coffre.svg";
|
||||||
// import { FrontendVariables } from "@Front/Config/VariablesFront";
|
|
||||||
import idNoteLogo from "@Assets/Icons/id-note-logo.svg";
|
import idNoteLogo from "@Assets/Icons/id-note-logo.svg";
|
||||||
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||||
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
||||||
import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage";
|
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 UserStore from "@Front/Stores/UserStore";
|
||||||
import Image from "next/image";
|
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 classes from "./classes.module.scss";
|
||||||
import LandingImage from "./landing-connect.jpeg";
|
import LandingImage from "./landing-connect.jpeg";
|
||||||
|
|
||||||
export default class LoginClass extends BasePage {
|
export default function Login() {
|
||||||
public override render(): JSX.Element {
|
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 (
|
return (
|
||||||
<DefaultDoubleSidePage title={"Login"} image={LandingImage}>
|
<DefaultDoubleSidePage title={"Login"} image={LandingImage}>
|
||||||
<div className={classes["root"]}>
|
<div className={classes["root"]}>
|
||||||
@ -20,7 +35,7 @@ export default class LoginClass extends BasePage {
|
|||||||
<Typography typo={ITypo.H1}>
|
<Typography typo={ITypo.H1}>
|
||||||
<div className={classes["title"]}>Connexion espace professionnel</div>
|
<div className={classes["title"]}>Connexion espace professionnel</div>
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button onClick={this.redirectUserOnConnection} icon={idNoteLogo} iconposition={"left"}>
|
<Button onClick={redirectUserOnConnection} icon={idNoteLogo} iconposition={"left"}>
|
||||||
S'identifier avec ID.not
|
S'identifier avec ID.not
|
||||||
</Button>
|
</Button>
|
||||||
<Typography typo={ITypo.P_18}>
|
<Typography typo={ITypo.P_18}>
|
||||||
@ -30,19 +45,4 @@ export default class LoginClass extends BasePage {
|
|||||||
</div>
|
</div>
|
||||||
</DefaultDoubleSidePage>
|
</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