We are working on a complex multi-level multi-tenant application, where the hostname is used to identify the 'supplier' account and the customer account is included in the URL structure.
For example, our routes are structured like this:
/:locale/app/:customer_id/invoices
On the webpage, there is a dropdown menu that displays all the customer IDs accessible to the user. The goal is for the user to be able to switch between customers, changing the route from /nl/app/4/invoices
to /nl/app/5/invoices
, for instance. So essentially, I am looking for a way to instruct the VueJs router to update only one parameter value within the current route.
This functionality also applies to the :locale
parameter, where we have a language selector at the top of the page.
I am aware that you can use $router.push
with a named route and pass in the current parameters, replacing the ones that need updating. However, this requires naming every single route and knowing the route's name when making an update.
Is there a simpler method to request VueJS Router to "provide me with the current route" and allow me to update a specific parameter?
I have conducted extensive research on Stack Overflow and other platforms but haven't found a satisfactory solution yet...