Compare commits
No commits in common. "b3d82f5b5d1e6c396e48346738249008d0e1006e" and "6cca4e0fd5dc616245e466162161f5bfb53a741e" have entirely different histories.
b3d82f5b5d
...
6cca4e0fd5
@ -227,52 +227,38 @@ export default class IdNotService extends BaseService {
|
|||||||
key: this.variables.IDNOT_API_KEY,
|
key: this.variables.IDNOT_API_KEY,
|
||||||
});
|
});
|
||||||
|
|
||||||
let userRawData: Response;
|
let userData: IRattachementData;
|
||||||
try {
|
try {
|
||||||
userRawData = await fetch(
|
userData = (await (
|
||||||
|
await fetch(
|
||||||
`${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/rattachements/${user.idNot}_${user.office_membership!.idNot}?` +
|
`${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/rattachements/${user.idNot}_${user.office_membership!.idNot}?` +
|
||||||
searchParams,
|
searchParams,
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
).json()) as IRattachementData;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error fetching user data for ${user.uid}: ${error}`);
|
console.error(`Error fetching user data for ${user.uid}: ${error}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userRawData.status === 404) {
|
|
||||||
console.error(`User ${user.uid} not found in idnot`);
|
|
||||||
return;
|
|
||||||
} else if (userRawData.status !== 200) {
|
|
||||||
console.error(`Error fetching user data for ${user.uid}: ${userRawData.status} - ${userRawData.statusText}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let userData = (await userRawData.json()) as IRattachementData;
|
|
||||||
|
|
||||||
console.log("Got userData from idnot", JSON.stringify(userData));
|
console.log("Got userData from idnot", JSON.stringify(userData));
|
||||||
|
|
||||||
if (userData.deleted) {
|
if (userData.deleted) {
|
||||||
let rattachements: any;
|
let rattachements: any;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rattachements = await fetch(`${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/personnes/${user.idNot}/rattachements?deleted=false` + searchParams, {
|
rattachements = (await (
|
||||||
|
await fetch(`${this.variables.IDNOT_API_BASE_URL}/api/pp/v2/personnes/${user.idNot}/rattachements?deleted=false` + searchParams, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
});
|
})
|
||||||
|
).json()) as any;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching rattachements", error);
|
console.error("Error fetching rattachements", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rattachements.status === 404) {
|
|
||||||
console.error(`User ${user.uid} not found in idnot`);
|
|
||||||
return;
|
|
||||||
} else if (rattachements.status !== 200) {
|
|
||||||
console.error(`Error fetching rattachements for ${user.uid}: ${rattachements.status} - ${rattachements.statusText}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rattachements.totalResultCount === 0) {
|
if (rattachements.totalResultCount === 0) {
|
||||||
console.warn("User has no valid rattachements", user.uid);
|
console.warn("User has no valid rattachements", user.uid);
|
||||||
await this.userService.updateCheckedAt(user.uid!);
|
await this.userService.updateCheckedAt(user.uid!);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user