refacto votes and connexion

This commit is contained in:
OxSaitama 2023-10-04 19:28:07 +02:00
parent 9c14c1df3b
commit f06539bb78
6 changed files with 3 additions and 9 deletions

View File

@ -24,7 +24,7 @@
"eslint-config-next": "13.2.4", "eslint-config-next": "13.2.4",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.89", "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.90",
"next": "13.2.4", "next": "13.2.4",
"prettier": "^2.8.7", "prettier": "^2.8.7",
"react": "18.2.0", "react": "18.2.0",

View File

@ -27,7 +27,6 @@ export default class User extends BaseApiService {
} }
public async verifyJwt(jwt: string) { public async verifyJwt(jwt: string) {
console.log(this.baseURl);
const url = new URL(`${this.baseURl}/verify-token/${jwt}`); const url = new URL(`${this.baseURl}/verify-token/${jwt}`);
try { try {
return await this.postRequest(url); return await this.postRequest(url);

View File

@ -16,7 +16,6 @@ export default class Auth extends BaseApiService {
public async logOutWithIdNot() { public async logOutWithIdNot() {
const variables = FrontendVariables.getInstance(); const variables = FrontendVariables.getInstance();
const url = new URL(`${variables.IDNOT_BASE_URL}/user/auth/logout?post_logout_redirect_uri=${variables.FRONT_APP_HOST}`); const url = new URL(`${variables.IDNOT_BASE_URL}/user/auth/logout?post_logout_redirect_uri=${variables.FRONT_APP_HOST}`);
console.log(url.toString())
try { try {
return await fetch(url); return await fetch(url);
} catch (err) { } catch (err) {

View File

@ -121,7 +121,6 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
{this.state.currentFiles && this.state.currentFiles.length > 0 && ( {this.state.currentFiles && this.state.currentFiles.length > 0 && (
<div className={classes["documents-container"]}> <div className={classes["documents-container"]}>
{this.state.currentFiles.map((file) => { {this.state.currentFiles.map((file) => {
console.log(file);
const fileObj = file.file; const fileObj = file.file;
@ -237,9 +236,6 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
this.setState({ this.setState({
currentFiles: tmpArray, currentFiles: tmpArray,
}); });
console.log(this.state.currentFiles);
// const formData = new FormData(); // const formData = new FormData();
// formData.append("file", file, file.name); // formData.append("file", file, file.name);
// const query = JSON.stringify({ document: { uid: this.props.document.uid } }); // const query = JSON.stringify({ document: { uid: this.props.document.uid } });
@ -272,7 +268,6 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
private async removeFile(e: any) { private async removeFile(e: any) {
const image = e.target as HTMLElement; const image = e.target as HTMLElement;
const indexToRemove = image.getAttribute("data-file"); const indexToRemove = image.getAttribute("data-file");
console.log(indexToRemove);
if (!indexToRemove) return; if (!indexToRemove) return;
const file = this.state.currentFiles!.find((file) => file.index === parseInt(indexToRemove)); const file = this.state.currentFiles!.find((file) => file.index === parseInt(indexToRemove));

View File

@ -22,6 +22,7 @@ export default function LoginCallBack() {
if (!code) return; if (!code) return;
try { try {
const token = await Auth.getInstance().getIdnotJwt(code as string); const token = await Auth.getInstance().getIdnotJwt(code as string);
if (!token) return router.push(Module.getInstance().get().modules.pages.Login.props.path);
await UserStore.instance.connect(token.accessToken, token.refreshToken); await UserStore.instance.connect(token.accessToken, token.refreshToken);
return router.push(Module.getInstance().get().modules.pages.Folder.props.path); return router.push(Module.getInstance().get().modules.pages.Folder.props.path);
} catch (e) { } catch (e) {

View File

@ -165,7 +165,7 @@ export default function UserInformations(props: IProps) {
let vote = Vote.hydrate<Vote>({ let vote = Vote.hydrate<Vote>({
appointment: Appointment.hydrate<Appointment>({ appointment: Appointment.hydrate<Appointment>({
uid: currentAppointment?.uid ?? undefined, uid: currentAppointment?.uid ?? undefined,
targeted_user: User.hydrate<User>({ user: User.hydrate<User>({
uid: userSelected.uid, uid: userSelected.uid,
}), }),
choice: superAdminModalType === "add" ? EVote.NOMINATE : EVote.DISMISS, choice: superAdminModalType === "add" ? EVote.NOMINATE : EVote.DISMISS,