Currently in the process of developing a small forum application using Laravel and Vue, I am working on implementing filter buttons to retrieve threads based on different criteria.
For instance, within a Vue component, there is a button that triggers a GET request to the backend to fetch threads that have been created by the authenticated user:
<a href="/threads?myThreads=1"> My Threads </a>
In addition to this button, there are other filters available as well, such as:
- Threads that I have replied to
- Threads created 7 days ago
I am looking to hide the clicked buttons based on the query strings present in the URL:
window.location.href
For example, when the My Threads button is clicked, the href will be:
/threads?=myThreads=1
In such cases, I aim to hide the My Threads button based on the content of the href.
My Query:
Is it problematic to take action based on the URL in this manner?
Would an alternative approach, like passing data from backend to frontend, be more suitable?