Skip to content

Commit 9d38a8c

Browse files
committed
bugfix(modeling-commons): fix sign up error on selecting user kind
1 parent 5d291fb commit 9d38a8c

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

  • apps/modeling-commons-frontend/app/pages/(auth)

apps/modeling-commons-frontend/app/pages/(auth)/signup.vue

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import type { FormSubmitEvent } from "@nuxt/ui";
33
import type * as z from "zod";
4-
import { signUpFields, signUpValidator, type UserKind } from "~/forms/auth";
4+
import { signUpFields, signUpValidator } from "~/forms/auth";
55
import { authRoutes, getSafeNextPath } from "~/utils/auth";
66
77
definePageMeta({
@@ -14,6 +14,7 @@ useSeoMeta({
1414
description: "Create an account to get started",
1515
});
1616
17+
const toast = useToast();
1718
const router = useRouter();
1819
const route = useRoute();
1920
const { signUpWithEmail } = useAuthActions();
@@ -39,11 +40,19 @@ async function onSubmit(payload: FormSubmitEvent<Schema>) {
3940
name,
4041
email,
4142
password,
42-
userKind: userKind as UserKind,
43+
userKind: userKind?.value ?? 'other',
4344
next: route.query.next,
4445
});
4546
46-
if (error) return;
47+
if (error) {
48+
toast.add({
49+
title: "Signup failed",
50+
description: error.message ?? "We couldn't create your account.",
51+
icon: "i-lucide-x-circle",
52+
color: "error",
53+
});
54+
return;
55+
}
4756
4857
await router.push({
4958
path: authRoutes.verifyEmail,
@@ -56,19 +65,11 @@ async function onSubmit(payload: FormSubmitEvent<Schema>) {
5665

5766
<template>
5867
<div>
59-
<UAuthForm
60-
ref="authform"
61-
:fields="fields"
62-
:schema="schema"
63-
title="Sign Up"
64-
loading-auto
65-
:submit="{
66-
label: 'Sign Up',
67-
color: 'primary',
68-
variant: 'solid',
69-
}"
70-
@submit="onSubmit"
71-
>
68+
<UAuthForm ref="authform" :fields="fields" :schema="schema" title="Sign Up" loading-auto :submit="{
69+
label: 'Sign Up',
70+
color: 'primary',
71+
variant: 'solid',
72+
}" @submit="onSubmit">
7273
<template #title>
7374
<h4>Sign Up</h4>
7475
</template>
@@ -83,10 +84,9 @@ async function onSubmit(payload: FormSubmitEvent<Schema>) {
8384
<span class="text-muted">
8485
By signing up, you agree to our
8586
<ULink to="/terms-of-service" class="font-medium text-primary underline">
86-
Terms of Service </ULink
87-
>.
87+
Terms of Service </ULink>.
8888
</span>
8989
</template>
9090
</UAuthForm>
9191
</div>
92-
</template>
92+
</template>

0 commit comments

Comments
 (0)