Added visual feedback when application is approved
This commit is contained in:
@@ -94,16 +94,18 @@ export async function approveApplication(id: Number) {
|
|||||||
const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST', credentials: 'include' })
|
const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST', credentials: 'include' })
|
||||||
|
|
||||||
if (!res.ok) {
|
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) {
|
export async function denyApplication(id: Number) {
|
||||||
const res = await fetch(`${addr}/application/deny/${id}`, { method: 'POST', credentials: 'include' })
|
const res = await fetch(`${addr}/application/deny/${id}`, { method: 'POST', credentials: 'include' })
|
||||||
|
|
||||||
if (!res.ok) {
|
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() {
|
export async function restartApplication() {
|
||||||
|
|||||||
@@ -105,11 +105,21 @@ async function postApp(appData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleApprove(id) {
|
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) {
|
async function handleDeny(id) {
|
||||||
await denyApplication(id);
|
try {
|
||||||
|
await denyApplication(id);
|
||||||
|
loadData(await loadApplication(Number(route.params.id), true))
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user