add loggs idNotService
This commit is contained in:
parent
c489138479
commit
a599548d4a
@ -122,22 +122,25 @@ export default class IdNotService extends BaseService {
|
||||
grant_type: "authorization_code",
|
||||
});
|
||||
|
||||
const token = await fetch(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" });
|
||||
const url = this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query;
|
||||
|
||||
console.log("URL");
|
||||
console.log(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" });
|
||||
console.log("getIdNotToken");
|
||||
console.log("Tentative de connexion à l'URL :", url);
|
||||
|
||||
try {
|
||||
const token = await fetch(url, { method: "POST" });
|
||||
console.log("Réponse du fetch :", token);
|
||||
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;
|
||||
} catch (error) {
|
||||
console.error("Erreur lors de l'appel à fetch :", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async getRole(roleName: string): Promise<Role> {
|
||||
@ -188,16 +191,22 @@ export default class IdNotService extends BaseService {
|
||||
const searchParams = new URLSearchParams({
|
||||
key: this.variables.IDNOT_API_KEY,
|
||||
});
|
||||
console.log("URL: getOfficeMemberships");
|
||||
|
||||
const URl = `${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/entites/${office.idNot}/personnes?` + searchParams;
|
||||
console.log(URl);
|
||||
console.log("getOfficeMemberships");
|
||||
|
||||
const response = await fetch(URl, {
|
||||
const url = `${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/entites/${office.idNot}/personnes?` + searchParams;
|
||||
|
||||
try {
|
||||
console.log("Tentative de connexion à l'URL :", url);
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
});
|
||||
|
||||
return (await response.json()) as any;
|
||||
} catch (error) {
|
||||
console.error("Erreur lors de l'appel à fetch :", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public getOfficeStatus(statusName: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user