Skip to content
Snippets Groups Projects
Commit 9263aa24 authored by Ewen Le Bihan's avatar Ewen Le Bihan
Browse files

feat(registrations): prevent empty reason when refusing registration

parent d196f3ae
Branches
Tags v0.52.0
No related merge requests found
......@@ -6,6 +6,7 @@
import { zeus } from '$lib/zeus';
import ButtonSecondary from '$lib/components/ButtonSecondary.svelte';
import { tooltip } from '$lib/tooltip';
import { toasts } from '$lib/toasts';
export let data: PageData;
......@@ -66,7 +67,13 @@
<ButtonSecondary
on:click={async () => {
// eslint-disable-next-line no-alert
await decide(email, false, prompt('pk ?') ?? '');
const reason = prompt('pk ?');
if (!reason) {
toasts.error("Il faut une raison pour refuser l'inscription");
return;
}
await decide(email, false, reason);
}}
icon={IconTrash}
danger
......
......@@ -17,6 +17,7 @@
import IconCheck from '~icons/mdi/check';
import IconSave from '~icons/mdi/content-save-outline';
import IconDelete from '~icons/mdi/delete-outline';
import { toasts } from '$lib/toasts';
export let data: PageData;
......@@ -67,13 +68,16 @@
if (register) await goto('../..');
} else {
loadingRefuse = true;
// eslint-disable-next-line no-alert
const reason = prompt('pk ?');
if (!reason) {
toasts.error('Il faut une raison pour refuser une inscription');
loading = false;
return;
}
await $zeus.mutate({
/* eslint-disable no-alert */
refuseRegistration: [
{ email: data.userCandidateByEmail.email, reason: prompt('pk ?') ?? '' },
true,
],
/* eslint-enable no-alert */
refuseRegistration: [{ email: data.userCandidateByEmail.email, reason }, true],
});
}
} finally {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment