hjortur17
336
22
Vue

Can't get Axios post response.

Posted 1 week ago by hjortur17

I can't get the data from axios post request. I'm posting to my api but when I'm trying to debug the data it just returns null.

Here is how I getting it:

addSessionKeyToSession() {
                axios.post('/api/session/add/key', {
                    sessionKey: this.sessionKey
                })
                .then(function (response) {
                    console.log(response.data)
                })
                .catch(function (error) {});
            }

And here is the response without .data:

config:
    adapter: ƒ xhrAdapter(config)
    data: "{"sessionKey":"b2dsm44h98h86ncacp4b89"}"
    ......

(And I'm trying to get sessionKey

Please sign in or create an account to participate in this conversation.