Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Vue - InertiaJS: Enter Object not able

In my props, I pass the array "ticket_data" when loading the Vue component. Now I want to make a post to a controller using the Inertia form. This also works without problems.

My problem is, I can not access individual values from the array ...

My 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'),
    });
};

If I submit props.ticket_data individually, the following post arrives at 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"}]}

If the data arrives with "props.ticket_data", why can't I just access it with "props.ticket_data.ticket_id" ?

"props.ticket_data.[1]" doesn't work like that either....

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Get a ticket by Id like this:

props.ticket_data.find(ticket => ticket.ticket_id === 5) // <-- ticket id
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!