Merge branch 'dev' of https://github.com/smart-chain-fr/leCoffre-front into dev
This commit is contained in:
commit
66b98cfe2a
@ -18,6 +18,7 @@
|
||||
"@types/react-dom": "18.0.11",
|
||||
"class-validator": "^0.14.0",
|
||||
"classnames": "^2.3.2",
|
||||
"crypto-random-string": "^5.0.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"eslint": "8.36.0",
|
||||
"eslint-config-next": "13.2.4",
|
||||
|
@ -57,6 +57,11 @@ export default class Files extends BaseSuperAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
public getUploadLink(uid: string): string {
|
||||
return this.baseURl.concat(`/upload/${uid}`);
|
||||
}
|
||||
|
||||
|
||||
public async getByUid(uid: string, q?: any): Promise<File> {
|
||||
const url = new URL(this.baseURl.concat(`/${uid}`));
|
||||
const query = { q };
|
||||
|
@ -20,6 +20,7 @@ import React from "react";
|
||||
import BasePage from "../../Base";
|
||||
import classes from "./classes.module.scss";
|
||||
import OcrResult from "./OcrResult";
|
||||
import Files from "@Front/Api/LeCoffreApi/SuperAdmin/Files/Files";
|
||||
|
||||
|
||||
type IProps = {};
|
||||
@ -90,7 +91,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
</div>
|
||||
)}
|
||||
<div className={classes["file-container"]}>
|
||||
<FilePreview href={this.state.selectedFile.file_path as string} key={this.state.selectedFile.uid} />
|
||||
<FilePreview href={Files.getInstance().getUploadLink(this.state.selectedFile?.uid as string)} key={this.state.selectedFile.uid} />
|
||||
</div>
|
||||
{this.state.document.files.length > 1 && (
|
||||
<div
|
||||
@ -199,7 +200,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
|
||||
private downloadFile() {
|
||||
const fileName = this.state.selectedFile?.file_path?.split("/").pop();
|
||||
fetch(this.state.selectedFile?.file_path as string)
|
||||
fetch(Files.getInstance().getUploadLink(this.state.selectedFile?.uid as string))
|
||||
.then((resp) => resp.blob())
|
||||
.then((blob) => {
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
|
@ -10,7 +10,7 @@ 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 Auth from "@Front/Api/Auth/IdNot";
|
||||
import Folder from "../Folder";
|
||||
import LoginClass from "../Login";
|
||||
|
||||
@ -75,15 +75,15 @@ 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);
|
||||
}
|
||||
};
|
||||
getIdNotJwt();
|
||||
// const getIdNotJwt = async () => {
|
||||
// try {
|
||||
// const authService = Auth.getInstance();
|
||||
// await authService.getIdnotJwt(code);
|
||||
// } catch (error) {
|
||||
// console.error(error);
|
||||
// }
|
||||
// };
|
||||
//getIdNotJwt();
|
||||
return <Folder {...props} />;
|
||||
}
|
||||
return <LoginClass {...props} />;
|
||||
|
@ -6,6 +6,8 @@ import Image from "next/image";
|
||||
import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage";
|
||||
import FranceConnectIcon from "./france-connect.svg";
|
||||
import ExportIcon from "@Assets/Icons/export.svg";
|
||||
import { FrontendVariables } from "@Front/Config/VariablesFront";
|
||||
import cryptoRandomString from "crypto-random-string";
|
||||
|
||||
export default class LoginCustomer extends BasePage {
|
||||
public override render(): JSX.Element {
|
||||
@ -35,12 +37,12 @@ export default class LoginCustomer extends BasePage {
|
||||
}
|
||||
|
||||
private redirectUserOnConnection() {
|
||||
// const variables = FrontendVariables.getInstance();
|
||||
const variables = FrontendVariables.getInstance();
|
||||
// const baseFronturl =
|
||||
// variables.BACK_API_PROTOCOL + variables.FRONT_APP_HOST + (variables.FRONT_APP_PORT ? ":" + variables.FRONT_APP_PORT : "");
|
||||
// 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);
|
||||
const authorizeEndPoint = variables.FC_AUTHORIZE_ENDPOINT;
|
||||
const clientId = variables.FC_CLIENT_ID;
|
||||
const url = `${authorizeEndPoint}?client_id=${clientId}&redirect_uri=http://localhost:8080/login-callback&scope=openid&response_type=code&state=${cryptoRandomString({length: 64})}&nonce=${cryptoRandomString({length: 64})}&acr_values=eidas1`;
|
||||
window.location.assign(url);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,10 @@ export class FrontendVariables {
|
||||
|
||||
public KEY_DATA!: string;
|
||||
|
||||
public FC_AUTHORIZE_ENDPOINT!: string;
|
||||
|
||||
public FC_CLIENT_ID!: string;
|
||||
|
||||
private constructor() {}
|
||||
|
||||
public static getInstance(): FrontendVariables {
|
||||
|
@ -19,6 +19,8 @@ type AppPropsWithLayout = AppProps & {
|
||||
frontAppHost: string;
|
||||
idNotAuthorizeEndpoint: string;
|
||||
idNotClientId: string;
|
||||
fcAuthorizeEndpoint: string;
|
||||
fcClientId: string;
|
||||
};
|
||||
|
||||
const MyApp = (({
|
||||
@ -31,6 +33,8 @@ const MyApp = (({
|
||||
frontAppHost,
|
||||
idNotAuthorizeEndpoint,
|
||||
idNotClientId,
|
||||
fcAuthorizeEndpoint,
|
||||
fcClientId
|
||||
}: AppPropsWithLayout) => {
|
||||
const getLayout = Component.getLayout ?? ((page) => <DefaultLayout children={page}></DefaultLayout>);
|
||||
|
||||
@ -42,6 +46,8 @@ const MyApp = (({
|
||||
instance.FRONT_APP_HOST = frontAppHost;
|
||||
instance.IDNOT_AUTHORIZE_ENDPOINT = idNotAuthorizeEndpoint;
|
||||
instance.IDNOT_CLIENT_ID = idNotClientId;
|
||||
instance.FC_AUTHORIZE_ENDPOINT= fcAuthorizeEndpoint;
|
||||
instance.FC_CLIENT_ID = fcClientId
|
||||
|
||||
return getLayout(<Component {...pageProps} />);
|
||||
}) as AppType;
|
||||
@ -56,6 +62,8 @@ MyApp.getInitialProps = async () => {
|
||||
frontAppPort: process.env["NEXT_PUBLIC_FRONT_APP_PORT"],
|
||||
idNotAuthorizeEndpoint: process.env["NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT"],
|
||||
idNotClientId: process.env["NEXT_PUBLIC_IDNOT_CLIENT_ID"],
|
||||
fcAuthorizeEndpoint: process.env["NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT"],
|
||||
fcClientId: process.env["NEXT_PUBLIC_FC_CLIENT_ID"]
|
||||
};
|
||||
};
|
||||
|
||||
|
5
src/pages/login-callback.tsx
Normal file
5
src/pages/login-callback.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import ClientDashboard from "@Front/Components/Layouts/ClientDashboard";
|
||||
|
||||
export default function Route() {
|
||||
return <ClientDashboard />;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user