Home

Issue: 2497

this.$axios request always return OPTIONS instead GET, POST, PUT, DELETE

[issue link]

components/index.vue

<template>
  <div>
    <p>{{ $store.state.token }}</p>
    <v-btn class @click="reqs">click to request</v-btn>
  </div>
</template>

<script>
export default {
  methods: {
    async reqs (ctx) {
      let me = await this.$axios.get('/cek')
      console.log(me.data)
    }
  }
}
</script>

so, i click “Click to request” and get this response from server
x
I have tried with postman, and the result is normally, but, why if i use nuxt axios modules the request always changed to OPTIONS (instead GET, POST, PUT)… what should i do ?

NOTE:

  • I use @nuxtjs/axios modules
  • I use setToken in requestInterceptors placed nuxt.config.js
This question is available on Nuxt.js community (#c2168)