Enabled restarting your application from denied state
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m23s

This commit is contained in:
2025-12-08 17:10:53 -05:00
parent df89d9bf67
commit e61bd1c5a1
3 changed files with 37 additions and 5 deletions

View File

@@ -22,8 +22,8 @@ router.post('/', async (req, res) => {
res.sendStatus(201); res.sendStatus(201);
} catch (err) { } catch (err) {
console.error('Insert failed:', err); console.error('Failed to create application: \n', err);
res.status(500).json({ error: 'Failed to save application' }); res.status(500).json({ error: 'Failed to create application' });
} }
}); });
@@ -170,4 +170,15 @@ VALUES(?, ?, ?);`
} }
}); });
router.post('/restart', async (req: Request, res: Response) => {
const user = req.user.id;
try {
await setUserState(user, MemberState.Guest);
res.sendStatus(200);
} catch (error) {
console.error('Comment failed:', error);
res.status(500).json({ error: 'Could not rester application' });
}
})
module.exports = router; module.exports = router;

View File

@@ -136,4 +136,15 @@ export async function denyApplication(id: Number) {
if (!res.ok) { if (!res.ok) {
console.error("Something went wrong denying the application") console.error("Something went wrong denying the application")
} }
}
export async function restartApplication() {
const res = await fetch(`${addr}/application/restart`, {
method: 'POST',
credentials: 'include'
})
if (!res.ok) {
console.error("Something went wrong restarting your application")
}
} }

View File

@@ -14,6 +14,7 @@ import { useUserStore } from '@/stores/user';
import { Check, Circle, Dot, Users, X } from 'lucide-vue-next' import { Check, Circle, Dot, Users, X } from 'lucide-vue-next'
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import Application from './Application.vue'; import Application from './Application.vue';
import { restartApplication } from '@/api/application';
function goToLogin() { function goToLogin() {
const redirectUrl = encodeURIComponent(window.location.origin + '/join') const redirectUrl = encodeURIComponent(window.location.origin + '/join')
@@ -71,10 +72,18 @@ const currentStep = computed<number>(() => {
}) })
const finalPanel = ref<'app' | 'message'>('message'); const finalPanel = ref<'app' | 'message'>('message');
const reloadKey = ref(0);
async function restartApp() {
await restartApplication();
await userStore.loadUser();
reloadKey.value++;
}
</script> </script>
<template> <template>
<div class="flex flex-col items-center mt-10 w-full"> <div class="flex flex-col items-center mt-10 w-full" :key="reloadKey">
<!-- Stepper Container --> <!-- Stepper Container -->
<div class="w-full flex justify-center"> <div class="w-full flex justify-center">
@@ -219,8 +228,8 @@ const finalPanel = ref<'app' | 'message'>('message');
</div> </div>
<!-- Denied message --> <!-- Denied message -->
<div v-else-if="userStore.state === 'denied'"> <div v-else-if="userStore.state === 'denied'">
<div class="w-full max-w-2xl p-8"> <div class="w-full max-w-2xl flex flex-col gap-8">
<h1 class="text-3xl sm:text-4xl font-bold mb-4 text-left text-destructive"> <h1 class="text-3xl sm:text-4xl font-bold text-left">
Application Not Approved Application Not Approved
</h1> </h1>
<div class="space-y-4 text-muted-foreground text-left leading-relaxed"> <div class="space-y-4 text-muted-foreground text-left leading-relaxed">
@@ -246,6 +255,7 @@ const finalPanel = ref<'app' | 'message'>('message');
Team</span> Team</span>
</p> </p>
</div> </div>
<Button class="w-min" @click="restartApp">Restart Application</Button>
</div> </div>
</div> </div>
</div> </div>