parent
3e2af8bbf6
commit
8df53e591b
@ -44,6 +44,8 @@
|
|||||||
|
|
||||||
<UCard variant="subtle" class="w-full" :ui="{ root: 'max-w-[500px]' }">
|
<UCard variant="subtle" class="w-full" :ui="{ root: 'max-w-[500px]' }">
|
||||||
<form name="contacts" method="POST" netlify @submit.prevent="onSubmit">
|
<form name="contacts" method="POST" netlify @submit.prevent="onSubmit">
|
||||||
|
<input type="hidden" name="form-name" value="contacts">
|
||||||
|
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
Как к вам обращаться
|
Как к вам обращаться
|
||||||
@ -198,11 +200,20 @@ const [phone, phoneAttrs] = defineField('phone')
|
|||||||
const [service, serviceAttrs] = defineField('service')
|
const [service, serviceAttrs] = defineField('service')
|
||||||
const [comment, commentAttrs] = defineField('comment')
|
const [comment, commentAttrs] = defineField('comment')
|
||||||
|
|
||||||
const onSubmit = handleSubmit((values) => {
|
const onSubmit = handleSubmit(async (values) => {
|
||||||
console.log('onSubmit', values)
|
const payload = new FormData()
|
||||||
|
payload.append('form-name', 'contacts')
|
||||||
|
Object.entries(values).forEach(([key, value]) => {
|
||||||
|
payload.append(key, value as any)
|
||||||
|
})
|
||||||
|
|
||||||
|
await fetch('/', {
|
||||||
|
method: 'POST',
|
||||||
|
body: payload,
|
||||||
|
})
|
||||||
|
|
||||||
toast.add({
|
toast.add({
|
||||||
title: 'Заявка успешно отправлена, мы скоро с вами свяжемся !',
|
title: 'Заявка успешно отправлена!',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user