cretueusebiu / vform

Handle Laravel-Vue forms and validation with ease.
https://vform.vercel.app
MIT License
610 stars 122 forks source link

Use with Vue3 Compition Api #148

Open ashikahmed-bd opened 1 year ago

ashikahmed-bd commented 1 year ago
<script setup>

import { reactive } from 'vue'
import Form from 'vform'

const form = reactive(new Form({
  phone: null,
  password: null,
}));

const onSubmit = async () => {
  const response = await axios.post('/api/login', form)
  console.log(response)
}

</script>
dipoahmed018 commented 1 year ago

You need to provide the data instead of the full Form instance.

Use this instead const response = await axios.post('/api/login', form.data())