Skip to content

Commit

Permalink
🧑‍💻 Added logs api calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
abdheshnayak committed Dec 4, 2023
1 parent 7eae1d5 commit 3ff94ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions web/lib/server/helpers/execute-query-with-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ export const ExecuteQueryWithContext = (
formatter: formatter<A, B, C>,
def?: any
): IExecutorResp<B, C> {
const apiName = `[API] ${
(q as any)?.definitions[0]?.selectionSet?.selections[0]?.name?.value || ''
}`;

const res: IExecutorResp<B, C> = async (variables) => {
const { transformer } = formatter;

console.time(apiName);

try {
const defCookie =
headers.get('klsession') || headers.get('cookie') || null;
Expand Down Expand Up @@ -97,6 +104,8 @@ export const ExecuteQueryWithContext = (
},
],
};
} finally {
console.timeEnd(apiName);
}
};

Expand Down
3 changes: 2 additions & 1 deletion web/lib/server/helpers/minimal-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ export const assureNotLoggedIn = async (ctx: { request: IRemixReq }) => {
headers: ctx.request.headers,
}).whoAmI();

if (whoAmI.data && whoAmI.data) {
if (whoAmI.data) {
return redirect(`/`);
}

return false;
};

Expand Down
1 change: 1 addition & 0 deletions web/src/apps/auth/routes/_auth._providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const restActions = async (ctx: IRemixCtx) => {
gitlabLoginUrl = '',
googleLoginUrl = '',
} = data || {};

return {
githubLoginUrl,
gitlabLoginUrl,
Expand Down

0 comments on commit 3ff94ac

Please sign in to comment.