When I load my Vue component, I pass the array "ticket_data" as a prop. I am able to successfully make a post to a controller using an Inertia form without any issues.
However, I am struggling to access individual values from the array...
This is my current code:
let props = defineProps({
ticket_data: Object,
ticket_messages: Object,
});
let form = useForm({
text: '',
});
let submit = () => {
form
.transform((data) => ({
data,
ticket_id: props.ticket_data.ticket_id, // null
ticket_id: props.ticket_data, // gives all Data see Json
}))
.post('/account/user/support/ticket/send', {
preserveScroll: true,
onSuccess: () => form.reset('text'),
});
};
When I try to access "props.ticket_data" individually and submit, the following data is sent to my controller:
"ticket_id":[{"user_id":1,"ticket_id":5,"reference":"Testticket","state":0,"author":"Kevin Johnson","text":"..","created_at":"11/04/22 - 19:58"}]}
I cannot simply access it with "props.ticket_data.ticket_id". Why doesn't this work?
Also, trying to access it like this - "props.ticket_data.[1]" - does not yield the desired result either...