ooade/vuex-examples

Search file on API

nnivxix opened this issue · 1 comments

Hi there thank for open this section, I'm really confused using vuex recently. i need more know about vuex.
My problem is i want search a data using API, example im using API from TMDB, let me know how to use vuex using query.

thank you

ooade commented

That isn't really a Vuex thing and besides, you might not need to use Vuex except when really necessary.

It really depends on how you want the search to be executed. The simplest approach would be to make the request as soon as the enter key or the submit button is pressed.

The other approach would be to fetch on almost every keystroke (that is, throttle key inputs).

So, if you intend to make use of Vuex, you can have an action to make the API request and save the search result in the state object then you can populate the page with the search results from the state.

If you need to learn to use Vuex well (you probably should learn to use it well), you can check out their official guide.