From 2d78da5a5637e5f500b573dff21a6dd6bc8264c6 Mon Sep 17 00:00:00 2001 From: Melissa Autumn Date: Tue, 3 Sep 2024 15:27:45 -0700 Subject: [PATCH] Handle validation errors for waiting list --- frontend/src/views/LoginView.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/LoginView.vue b/frontend/src/views/LoginView.vue index 37d92ea3b..2955db7a5 100644 --- a/frontend/src/views/LoginView.vue +++ b/frontend/src/views/LoginView.vue @@ -75,10 +75,17 @@ const signUp = async () => { isLoading.value = true; loginError.value = ''; - const { data }: BooleanResponse = await call('waiting-list/join').post({ + const { data, error }: BooleanResponse = await call('waiting-list/join').post({ email: email.value, }).json(); + if (error?.value) { + // Handle error + loginError.value = (data?.value as Exception)?.detail[0]?.msg; + isLoading.value = false; + return; + } + if (!data.value) { loginError.value = t('waitingList.signUpAlreadyExists');