diff --git a/src/services/common/IdNotService/IdNotService.ts b/src/services/common/IdNotService/IdNotService.ts index b108aed5..26ad9cb7 100644 --- a/src/services/common/IdNotService/IdNotService.ts +++ b/src/services/common/IdNotService/IdNotService.ts @@ -124,12 +124,19 @@ export default class IdNotService extends BaseService { const token = await fetch(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" }); + console.log("URL"); + console.log(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" }); + if (token.status !== 200) console.error(await token.text()); const decodedToken = (await token.json()) as IIdNotToken; + console.log({ decodedToken }); + const decodedIdToken = jwt.decode(decodedToken.id_token) as IdNotJwtPayload; + console.log({ decodedIdToken }); + return decodedIdToken; } @@ -181,11 +188,16 @@ export default class IdNotService extends BaseService { const searchParams = new URLSearchParams({ key: this.variables.IDNOT_API_KEY, }); - return (await ( - await fetch(`${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/entites/${office.idNot}/personnes?` + searchParams, { - method: "GET", - }) - ).json()) as any; + console.log("URL: getOfficeMemberships"); + + const URl = `${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/entites/${office.idNot}/personnes?` + searchParams; + console.log(URl); + + const response = await fetch(URl, { + method: "GET", + }); + + return (await response.json()) as any; } public getOfficeStatus(statusName: string) { @@ -289,7 +301,7 @@ export default class IdNotService extends BaseService { await this.userService.updateCheckedAt(user.uid!); } - public async updateOffice(officeId: string) { + public async updateOffice(officeId: string) { const officeInfos = await this.officeService.getByUid(officeId); const office = Office.hydrate(officeInfos!); const searchParams = new URLSearchParams({