Update logging

This commit is contained in:
Darren Clarke 2025-01-22 17:50:38 +01:00
parent def602c05e
commit 810a333429
39 changed files with 85 additions and 139 deletions

View file

@ -46,7 +46,7 @@ const getUserRoles = async (email: string) => {
});
return roles.filter((role: string) => role !== null);
} catch (e) {
console.log({ e });
console.error({ e });
return [];
}
};

View file

@ -13,21 +13,18 @@ export const fetchLeafcutter = async (url: string, options: any) => {
const json = await res.json();
return json;
} catch (error) {
console.log({ error });
console.error({ error });
return null;
}
};
const data = await fetchData(url, options);
console.log({ data });
if (!data) {
const csrfURL = `${process.env.NEXT_PUBLIC_LEAFCUTTER_URL}/api/auth/csrf`;
const csrfData = await fetchData(csrfURL, {});
console.log({ csrfData });
const authURL = `${process.env.NEXT_PUBLIC_LEAFCUTTER_URL}/api/auth/callback/credentials`;
const authData = await fetchData(authURL, { method: "POST" });
console.log({ authData });
if (!authData) {
return null;
} else {
@ -37,5 +34,3 @@ export const fetchLeafcutter = async (url: string, options: any) => {
return data;
}
};