Enabled restarting your application from denied state
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m23s
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m23s
This commit is contained in:
@@ -22,8 +22,8 @@ router.post('/', async (req, res) => {
|
||||
|
||||
res.sendStatus(201);
|
||||
} catch (err) {
|
||||
console.error('Insert failed:', err);
|
||||
res.status(500).json({ error: 'Failed to save application' });
|
||||
console.error('Failed to create application: \n', err);
|
||||
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;
|
||||
|
||||
@@ -136,4 +136,15 @@ export async function denyApplication(id: Number) {
|
||||
if (!res.ok) {
|
||||
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")
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import { useUserStore } from '@/stores/user';
|
||||
import { Check, Circle, Dot, Users, X } from 'lucide-vue-next'
|
||||
import { computed, ref } from 'vue';
|
||||
import Application from './Application.vue';
|
||||
import { restartApplication } from '@/api/application';
|
||||
|
||||
function goToLogin() {
|
||||
const redirectUrl = encodeURIComponent(window.location.origin + '/join')
|
||||
@@ -71,10 +72,18 @@ const currentStep = computed<number>(() => {
|
||||
})
|
||||
|
||||
const finalPanel = ref<'app' | 'message'>('message');
|
||||
|
||||
const reloadKey = ref(0);
|
||||
|
||||
async function restartApp() {
|
||||
await restartApplication();
|
||||
await userStore.loadUser();
|
||||
reloadKey.value++;
|
||||
}
|
||||
</script>
|
||||
|
||||
<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 -->
|
||||
<div class="w-full flex justify-center">
|
||||
@@ -219,8 +228,8 @@ const finalPanel = ref<'app' | 'message'>('message');
|
||||
</div>
|
||||
<!-- Denied message -->
|
||||
<div v-else-if="userStore.state === 'denied'">
|
||||
<div class="w-full max-w-2xl p-8">
|
||||
<h1 class="text-3xl sm:text-4xl font-bold mb-4 text-left text-destructive">
|
||||
<div class="w-full max-w-2xl flex flex-col gap-8">
|
||||
<h1 class="text-3xl sm:text-4xl font-bold text-left">
|
||||
Application Not Approved
|
||||
</h1>
|
||||
<div class="space-y-4 text-muted-foreground text-left leading-relaxed">
|
||||
@@ -246,6 +255,7 @@ const finalPanel = ref<'app' | 'message'>('message');
|
||||
Team</span>
|
||||
</p>
|
||||
</div>
|
||||
<Button class="w-min" @click="restartApp">Restart Application</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user