From 216f3a0d1b52144963593d1ed24a6887c771c03a Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Mon, 17 Jul 2023 17:18:55 -0400 Subject: [PATCH] reload page after org link --- .../linkGitAppInstallationWithOrganization.ts | 2 +- frontend/src/pages/org/[id]/secret-scanning/index.tsx | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/api/secret-scanning/linkGitAppInstallationWithOrganization.ts b/frontend/src/pages/api/secret-scanning/linkGitAppInstallationWithOrganization.ts index 5a5e6051a..fa841d9c5 100644 --- a/frontend/src/pages/api/secret-scanning/linkGitAppInstallationWithOrganization.ts +++ b/frontend/src/pages/api/secret-scanning/linkGitAppInstallationWithOrganization.ts @@ -16,7 +16,7 @@ const linkGitAppInstallationWithOrganization = (installationId: string, sessionI }) }).then(async (res) => { if (res && res.status === 200) { - return res.json(); + return true } console.log("Failed to link installation to organization"); return undefined; diff --git a/frontend/src/pages/org/[id]/secret-scanning/index.tsx b/frontend/src/pages/org/[id]/secret-scanning/index.tsx index adf632d1e..e0f98243a 100644 --- a/frontend/src/pages/org/[id]/secret-scanning/index.tsx +++ b/frontend/src/pages/org/[id]/secret-scanning/index.tsx @@ -18,7 +18,11 @@ export default function SecretScanning() { const linkInstallation = async () => { if (typeof queryParams.state === "string" && typeof queryParams.installation_id === "string"){ try { - await linkGitAppInstallationWithOrganization(queryParams.installation_id as string, queryParams.state as string) + const isLinked = await linkGitAppInstallationWithOrganization(queryParams.installation_id as string, queryParams.state as string) + if (isLinked){ + router.reload() + } + console.log("installation verification complete") }catch (e){ console.log("app installation is stale, start new session", e)