search page dont work
it only shows the result of the first search, to show the results of other searches, the user has to refresh the page


30 Replies
code [...search].vue:
code layouts:
Hi, trying to help :
You don't have to add an extra "watch" method because useFetch is already listening through options obj
dont worked : c
just made a typo (i forgot to delete your allProducts ref)
that didn't work either
F
does it have something to do with the backend?

i tried do this too, but it dont work too
You can come back to your previous version (with useFetch)
You don't have to specify ".get" in "/api/search.get"
If you want to specify the method (- not needed when it's GET request because its the default value) :
it should work now
you also should add console.log to your [...search].get.ts in order to see if you reach the endpoint (you would be able to determine your issue about your wrong API path if u had it before)
dont worked
could the problem be with the file name?


and is it possible to send a props from search.vue to layouts? if so, how do i do that? i was thinking of doing something but i don't know if it will work
Your second capture ! You still use
/api/search.get
Remove .gettoo dont work bro
bro, do you know how to get a props from search and send to layouts?
im thinking do a thing
like, i im thinking get the "refresh" from search.vue and send to layouts, for the page to be loaded every time the user performs a search


give me a reproduction on stackblitz
you don't have to create a tricky behavior to do this
I made a new commit on the project's github without the search bar. Is it possible for me to create a project on stackblitz with an old version of the project?
i had given up on adding the search bar to the project...
best would be providing only the search bar there 😉
you want the reproduction as minimal as possible
hmm, ok, here is the link:
https://stackblitz.com/edit/nuxt-starter-wcjssg?file=package.json
Jonathan
StackBlitz
Nuxt - Starter (forked) - StackBlitz
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.
but it stay only on that screen, its ok?

and my bad for my poor english
i think we need to know your wanted behavior
My guess is :
- You can init the page with searched results through your query like : http://myurl.com?search=blablabla
- Each time you're writing something in the search bar, it triggers again a fetch method, and write the search result in the URL query part :
- So, if you type "product1" in the search bar
- Your query URL will be : http://myurl.com?search=product1
can't it be done differently? I'd like it to be something like this: http://myurl.com/search?q=product1
like, first, if dont have a query, it to get all products, and when have a query, its to get all products from query
i hope you understood, since my English isn't that good
ok im gonna try something on a stackblitz repro then, will tell you soon
I managed to solve it, but there's a small bug. When I navigate between pages, go back to the home page, or click on an item, the items on the search page go into loading state, even though they shouldn't


is it possible to fix this?
Yes, it is
You check for pending while you might want to check for pending and if there is no data yet
I couldn't solve it : (
I think the issue lies here:
and another issue arose: the checkboxes deactivate after the page is refreshed. I was hoping for them to remain active if any of them were in the URL




i suspect the issue lies with the UCheckbox tags because when I log the selectedCategory and selectedPrice, the values from the URL appear