<template>
<div class="flex flex-col items-center justify-center gap-4 p-4 min-h-screen">
<UPageCard class="w-full max-w-md">
<UAuthForm
title="Sign Up for [name]"
description="Enter your credentials to access your account."
icon="i-lucide-user"
:fields="fields"
:providers="providers"
@submit="onSubmit"
:state="state"
/>
</UPageCard>
</div>
</template>
<script setup>
import { useToast } from '@nuxt/ui/runtime/composables/useToast.js'
import { reactive } from 'vue'
const toast = useToast()
const fields = [{
name: 'email',
type: 'email',
label: 'Email',
placeholder: 'Enter your email',
required: true
}, {
name: 'password',
label: 'Password',
type: 'password',
placeholder: 'Enter your password',
required: true
}]
const providers = [
{
label: 'Google',
icon: 'logos:google-icon',
onClick: () => {
toast.add({ title: 'Google', description: 'Login with Google' })
}
},
{
label: 'GitHub',
icon: 'logos:github-icon',
onClick: () => {
toast.add({ title: 'GitHub', description: 'Login with GitHub' })
}
}
]
const state = reactive({
email: '',
password: '',
})
const validate = (state) => {
console.log(state)
const errors = []
if (!state.email) errors.push({ name: 'email', message: 'Email is required' })
if (!state.password) errors.push({ name: 'password', message: 'Password is required' })
console.log('Validation errors', errors)
return errors
}
function onSubmit(payload) {
console.log('Form submitted', payload)
}
</script>
so for some reason my onSubmit isnt being called. and i have no idea why. most of this code is copied straight from the website but my nuxtui4 just isnt working