From 618c2903188682e9a2e6c3f2cde9e62b7c48f490 Mon Sep 17 00:00:00 2001 From: ajdj100 Date: Mon, 15 Dec 2025 13:14:30 -0500 Subject: [PATCH] Added visual feedback when application is approved --- ui/src/api/application.ts | 6 ++++-- ui/src/pages/Application.vue | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index f814b15..e6d41bf 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -94,16 +94,18 @@ export async function approveApplication(id: Number) { const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST', credentials: 'include' }) if (!res.ok) { - console.error("Something went wrong approving the application") + throw new Error("Something went wrong approving the application"); } + return; } export async function denyApplication(id: Number) { const res = await fetch(`${addr}/application/deny/${id}`, { method: 'POST', credentials: 'include' }) if (!res.ok) { - console.error("Something went wrong denying the application") + throw new Error("Something went wrong denyting the application"); } + return; } export async function restartApplication() { diff --git a/ui/src/pages/Application.vue b/ui/src/pages/Application.vue index 30f944a..98e7ff7 100644 --- a/ui/src/pages/Application.vue +++ b/ui/src/pages/Application.vue @@ -105,11 +105,21 @@ async function postApp(appData) { } async function handleApprove(id) { - await approveApplication(id); + try { + await approveApplication(id); + loadData(await loadApplication(Number(route.params.id), true)) + } catch (error) { + console.error(error); + } } async function handleDeny(id) { - await denyApplication(id); + try { + await denyApplication(id); + loadData(await loadApplication(Number(route.params.id), true)) + } catch (error) { + console.error(error); + } }