amora2972's avatar

remote selects (ajax select) and query params

Hello there, I'm using vue js for the frontend and laravel for the backend, when I filter the results on the vuejs side, I'm adding those filtered parameters to the url for example, let's say I'm filtering a list of classes by their teachers so I'm sending to the classes endpoint filter[teacher_id]: 3, then I'm adding to the url https://example.com/classes?filter[teacher_id]=3.

the issue starts when I use remote selects or ajax selects to list teachers, if the end user selects a teacher by filtering the results and this teacher doesn't come in the first page, i have no access to this teacher if the user refreshes the page and i don't have his name, I'm thinking of multiple way to solve this issue one of them is:

  1. to send all those params in the url to the main api call on page load so it gives me the data of all of these filters
  2. to call the show method of teacher and asking it to provide me with the needed data.

however I'm feeling like there's a better or different solution if anyone has any idea please share it with me.

thanks,

0 likes
0 replies

Please or to participate in this conversation.