59 lines
2.4 KiB
TypeScript
59 lines
2.4 KiB
TypeScript
import LandingImage from "../Login/landing-connect.jpeg";
|
|
import Image from "next/image";
|
|
import CoffreIcon from "@Assets/Icons/coffre.svg";
|
|
import { useRouter } from "next/router";
|
|
import React, { useEffect } from "react";
|
|
import classes from "./classes.module.scss";
|
|
//import Module from "@Front/Config/Module";
|
|
//import Auth from "@Front/Api/Auth/IdNot";
|
|
import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage";
|
|
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
|
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
|
import Loader from "@Front/Components/DesignSystem/Loader";
|
|
// import { FrontendVariables } from "@Front/Config/VariablesFront";
|
|
// import CustomerStore from "@Front/Stores/CustomerStore";
|
|
import Customers from "@Front/Api/LeCoffreApi/Id360/Customers/Customers";
|
|
import CustomerStore from "@Front/Stores/CustomerStore";
|
|
import Module from "@Front/Config/Module";
|
|
import Link from "next/link";
|
|
|
|
export default function LoginCallBack() {
|
|
const router = useRouter();
|
|
|
|
useEffect(() => {
|
|
const getReport = async () => {
|
|
const tokenid360 = router.query["token"];
|
|
if (!tokenid360) return;
|
|
// const variables = FrontendVariables.getInstance();
|
|
// console.log(`${variables.DOCAPOST_API_URL}/enrollment/status/${tokenid360}/`)
|
|
// const reportRes = await fetch(`${variables.DOCAPOST_API_URL}/enrollment/status/${tokenid360}`, { method: "GET"});
|
|
// const report = await reportRes.json() as id360ProcessResponse;
|
|
const token = await Customers.getInstance().loginCallback(tokenid360);
|
|
CustomerStore.instance.connect(token.accessToken, token.refreshToken);
|
|
router.push(Module.getInstance().get().modules.pages.Folder.pages.Select.props.path);
|
|
};
|
|
getReport();
|
|
}),
|
|
[router];
|
|
|
|
return (
|
|
<DefaultDoubleSidePage title={"Login"} image={LandingImage}>
|
|
<div className={classes["root"]}>
|
|
<Image alt="coffre" src={CoffreIcon} />
|
|
<Typography typo={ITypo.H1}>
|
|
<div className={classes["title"]}>Connexion espace client</div>
|
|
</Typography>
|
|
<div className={classes["loader"]}>
|
|
<Loader />
|
|
</div>
|
|
<Typography typo={ITypo.P_18}>
|
|
<div className={classes["forget-password"]}>Vous n'arrivez pas à vous connecter ?</div>
|
|
</Typography>
|
|
<Link href="mailto:g.texier@notaires.fr">
|
|
<Button variant={EButtonVariant.LINE}>Contacter l'administrateur</Button>
|
|
</Link>
|
|
</div>
|
|
</DefaultDoubleSidePage>
|
|
);
|
|
}
|