Hey 👋
I'm trying to retrieve errors from a POST request.
Backend
return redirect()->back()->withErrors(['foo' => 'bar']);
Frontend
<script setup>
import { computed, watch } from 'vue'
import { usePage, router } from '@inertiajs/vue3'
const { props } = usePage()
const errors = computed(() => props.errors)
watch(errors, (newErrors) => {
console.log(newErrors)
})
function submit() {
router.post('/foo')
}
</script>
What am I missing?
Thank you 😄