-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathsignup.vue
More file actions
83 lines (73 loc) · 1.73 KB
/
Copy pathsignup.vue
File metadata and controls
83 lines (73 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<script setup lang="ts">
import * as z from 'zod'
import type { FormSubmitEvent } from '@nuxt/ui'
definePageMeta({
layout: 'auth'
})
useSeoMeta({
title: 'Sign up',
description: 'Create an account to get started'
})
const toast = useToast()
const fields = [{
name: 'name',
type: 'text' as const,
label: 'Name',
placeholder: 'Enter your name'
}, {
name: 'email',
type: 'text' as const,
label: 'Email',
placeholder: 'Enter your email'
}, {
name: 'password',
label: 'Password',
type: 'password' as const,
placeholder: 'Enter your password'
}]
const providers = [{
label: 'Google',
icon: 'i-simple-icons-google',
onClick: () => {
toast.add({ title: 'Google', description: 'Login with Google' })
}
}, {
label: 'GitHub',
icon: 'i-simple-icons-github',
onClick: () => {
toast.add({ title: 'GitHub', description: 'Login with GitHub' })
}
}]
const schema = z.object({
name: z.string().min(1, 'Name is required'),
email: z.email('Invalid email'),
password: z.string().min(8, 'Must be at least 8 characters')
})
type Schema = z.output<typeof schema>
function onSubmit(payload: FormSubmitEvent<Schema>) {
console.log('Submitted', payload)
}
</script>
<template>
<UAuthForm
:fields="fields"
:schema="schema"
:providers="providers"
title="Create an account"
:submit="{ label: 'Create account' }"
@submit="onSubmit"
>
<template #description>
Already have an account? <ULink
to="/login"
class="text-primary font-medium"
>Login</ULink>.
</template>
<template #footer>
By signing up, you agree to our <ULink
to="/"
class="text-primary font-medium"
>Terms of Service</ULink>.
</template>
</UAuthForm>
</template>