add host variables depending on env
This commit is contained in:
parent
395527cb1e
commit
139cbbf4f6
@ -1,5 +1,6 @@
|
||||
import { Service } from "typedi";
|
||||
import BaseApiService from "@Front/Api/BaseApiService";
|
||||
import { FrontendVariables } from "@Front/Config/VariablesFront";
|
||||
|
||||
@Service()
|
||||
export default class Auth extends BaseApiService {
|
||||
@ -25,15 +26,18 @@ export default class Auth extends BaseApiService {
|
||||
}
|
||||
}
|
||||
|
||||
public async getIdnotJwt(autorizationCode: string | string[]) {
|
||||
public async getIdnotJwt(autorizationCode: string | string[]): Promise<any> {
|
||||
const baseBackUrl = FrontendVariables.getInstance().BACK_API_PROTOCOL +
|
||||
FrontendVariables.getInstance().BACK_API_HOST +
|
||||
(FrontendVariables.getInstance().BACK_API_PORT ? ":" + FrontendVariables.getInstance().BACK_API_PORT : "");
|
||||
const url = new URL(
|
||||
`http://127.0.0.1:3001/api/v1/idnot-user/${autorizationCode}`
|
||||
`${baseBackUrl}/api/v1/idnot-user/${autorizationCode}`
|
||||
);
|
||||
try {
|
||||
await this.postRequest<any>(url);
|
||||
return await this.postRequest<any>(url);
|
||||
} catch (err) {
|
||||
this.onError(err);
|
||||
//return Promise.reject(err);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,43 @@
|
||||
// import classes from "./classes.module.scss";
|
||||
// import LandingImage from "../Login/landing-connect.png";
|
||||
// import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage";
|
||||
// import Image from "next/image";
|
||||
// import CoffreIcon from "@Assets/Icons/coffre.svg";
|
||||
// import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||
// import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
//import React, { useEffect, useState } from "react";
|
||||
import React from "react";
|
||||
//import Loader from "@Front/Components/DesignSystem/Loader";
|
||||
import Auth from "@Front/Api/Auth/IdNot";
|
||||
import Folder from "../Folder";
|
||||
import LoginClass from "../Login";
|
||||
|
||||
type IPropsClass = {};
|
||||
type IPropsClass = {};
|
||||
|
||||
//type IStateClass = {};
|
||||
// type IStateClass = {};
|
||||
|
||||
// class LoginCallBackClass extends React.Component<IPropsClass, IStateClass> {
|
||||
// public override render(): JSX.Element {
|
||||
// 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 professionnel
|
||||
// </div>
|
||||
// </Typography>
|
||||
// <Loader />
|
||||
// <Typography typo={ITypo.P_18}>
|
||||
// <div className={classes["forget-password"]}>
|
||||
// Vous n’arrivez pas à vous connecter ?
|
||||
// </div>
|
||||
// </Typography>
|
||||
// <Button variant={EButtonVariant.LINE}>
|
||||
// Contacter l’administrateur
|
||||
// </Button>
|
||||
// </div>
|
||||
// </DefaultDoubleSidePage>
|
||||
// );
|
||||
@ -25,20 +45,47 @@ type IPropsClass = {};
|
||||
// }
|
||||
|
||||
// TODO: Refacto with functionnal component container of classcomponent
|
||||
// export default function LoginCallBack(props: IPropsClass) {
|
||||
// const [user, setUser] = useState(null);
|
||||
// const [isLoading, setIsLoading] = useState(false);
|
||||
// const router = useRouter();
|
||||
// const { code } = router.query;
|
||||
// if (code) {
|
||||
// useEffect(() => {
|
||||
// const getIdNotJwt = async () => {
|
||||
// setIsLoading(true);
|
||||
// try {
|
||||
// const authService = Auth.getInstance();
|
||||
// const fetchedUser = await authService.getIdnotJwt(code);
|
||||
// setUser(fetchedUser);
|
||||
// } catch (error) {
|
||||
// console.error(error);
|
||||
// // Router.push('/login');
|
||||
// }
|
||||
// };
|
||||
// getIdNotJwt();
|
||||
// }, []);
|
||||
// if (isLoading) return <LoginCallBackClass {... props}/>
|
||||
// return <Folder {...props} />;
|
||||
// }
|
||||
// return <LoginClass {...props}/>
|
||||
// }
|
||||
|
||||
export default function LoginCallBack(props: IPropsClass) {
|
||||
const router = useRouter();
|
||||
const { code } = router.query;
|
||||
if (code) {
|
||||
const getIdNotJwt = async () => {
|
||||
try {
|
||||
const authService = Auth.getInstance();
|
||||
await authService.getIdnotJwt(code);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
// Router.push('/login');
|
||||
}
|
||||
};
|
||||
getIdNotJwt();
|
||||
const router = useRouter();
|
||||
const { code } = router.query;
|
||||
if (code) {
|
||||
const getIdNotJwt = async () => {
|
||||
try {
|
||||
const authService = Auth.getInstance();
|
||||
await authService.getIdnotJwt(code);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
// Router.push('/login');
|
||||
}
|
||||
};
|
||||
getIdNotJwt();
|
||||
return <Folder {...props} />;
|
||||
}
|
||||
return <LoginClass {...props}/>
|
||||
}
|
||||
return <Folder {...props} />;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user