Actually, I don't want to rerender the page, I just need this data to populate a select input field. so the user can pick a sponsor and continue with the registration.
I have switch to using axios and now axios complain that members is not defined
let sponsorsearch = ref('');
let members = ref([]);
let form = useForm({
name: null,
email: null,
country: 'Nigeria',
state: null,
lga: null,
gender: null,
title: 'Choose a title',
mobile: null,
business_name: null,
dob: null,
serial_no: null,
r_address: null,
p_address: null,
working_status: 'Working Status',
description: null,
sponsorid: null,
})
watch(sponsorsearch, value => {
// Inertia.get('/getsponsors', {search: value}, {
// preserveState: true,
// });
axios.get('/getsponsors', {params: {search: value}})
.then((data) => {
this.members = data.data
})
});
The error I get in console
TypeError: Cannot set properties of undefined (setting 'members')