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

@ -41,7 +41,6 @@ export const ZammadWrapper: FC<ZammadWrapperProps> = ({
method: "GET",
redirect: "manual",
});
console.log({ res });
if (res.type === "opaqueredirect") {
setAuthenticated(true);
} else {

View file

@ -156,14 +156,12 @@ export const getTicketStatesAction = async () => {
const states = await executeREST({
path: "/api/v1/ticket_states",
});
console.log({ states });
const formattedStates =
states?.map((state: any) => ({
value: `gid://zammad/Ticket::State/${state.id}`,
label: state.name,
disabled: ["new", "merged", "removed"].includes(state.name),
})) ?? [];
console.log({ formattedStates });
return formattedStates;
} catch (e) {
console.error(e.message);

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;
}
};

View file

@ -12,7 +12,7 @@ const rewriteURL = (
path = path.slice(1);
}
const destinationURL = `${destinationBaseURL}/${path}`;
console.log(`Rewriting ${request.url} to ${destinationURL}`);
console.info(`Rewriting ${request.url} to ${destinationURL}`);
const requestHeaders = new Headers(request.headers);
requestHeaders.delete("x-forwarded-user");

View file

@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.