Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SDCODE's avatar

Vuex

How to pass query parameter in action method...on axios call. And how to dispatch in vuefile?

0 likes
4 replies
vincent15000's avatar

Can you share your code, what you have tried, please ?

To dispatch a result to a vue view, you have to call the data from the store.

SDCODE's avatar

@vincent15000

SHOW_CATEGORY(context) {
    return new Promise((resolve, reject) => {
        axios.get('http://localhost:8080/api/get-search')
            .then((res) => {
                resolve(res)
            }).catch((err) => {
                reject(err)
            });
    })
1 like
SDCODE's avatar

in this API, i want to pass parameter to search name

1 like
vincent15000's avatar

@SDCODE You can add a search parameter in the get request. Then you retrieve the content of the search parameter in the backend to filter the datas.

Please or to participate in this conversation.