From 208d5dee7ebb3c9ce41847d07a01730da48a7339 Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Mon, 4 Dec 2023 15:08:16 +0530 Subject: [PATCH] :technologist: Added logs api calls. --- lib/server/helpers/execute-query-with-context.ts | 9 +++++++++ lib/server/helpers/minimal-auth.ts | 3 ++- src/apps/auth/routes/_auth._providers.tsx | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/server/helpers/execute-query-with-context.ts b/lib/server/helpers/execute-query-with-context.ts index 23a493069..d4b54d55b 100644 --- a/lib/server/helpers/execute-query-with-context.ts +++ b/lib/server/helpers/execute-query-with-context.ts @@ -41,8 +41,15 @@ export const ExecuteQueryWithContext = ( formatter: formatter, def?: any ): IExecutorResp { + const apiName = `[API] ${ + (q as any)?.definitions[0]?.selectionSet?.selections[0]?.name?.value || '' + }`; + const res: IExecutorResp = async (variables) => { const { transformer } = formatter; + + console.time(apiName); + try { const defCookie = headers.get('klsession') || headers.get('cookie') || null; @@ -97,6 +104,8 @@ export const ExecuteQueryWithContext = ( }, ], }; + } finally { + console.timeEnd(apiName); } }; diff --git a/lib/server/helpers/minimal-auth.ts b/lib/server/helpers/minimal-auth.ts index 913247bee..b234076b0 100644 --- a/lib/server/helpers/minimal-auth.ts +++ b/lib/server/helpers/minimal-auth.ts @@ -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; }; diff --git a/src/apps/auth/routes/_auth._providers.tsx b/src/apps/auth/routes/_auth._providers.tsx index 00c61d059..5b6b10606 100644 --- a/src/apps/auth/routes/_auth._providers.tsx +++ b/src/apps/auth/routes/_auth._providers.tsx @@ -33,6 +33,7 @@ export const restActions = async (ctx: IRemixCtx) => { gitlabLoginUrl = '', googleLoginUrl = '', } = data || {}; + return { githubLoginUrl, gitlabLoginUrl,