[Vuejs]-How to pass params using fetch API in vuejs vuex store action

0👍

For send parameter(s) you need to use parameter passing by GET or POST method or use a more convenient library like Axios

let data = [ {'a': name, 'b': name}];

fetch(`/api/getnames?dict=`+JSON.stringify(data) ) ...
request.GET['dict']

or

fetch('/api/getnames', {
            method: 'POST',
            body: JSON.stringify({dict: data})
        } ) ...

or

axios.post('/api/getnames', { dict: [ {'a': name, 'b': name}] } );

request.POST['dict']

Leave a comment