In my Indexin.vue
.
<template>
<div
class="col-md-3 col-lg-3 col-sm-3 m-3 card"
v-for="data in indexingList"
:key="data.indexing_id">
<div>
<base-button
type="primary"
size="sm"
@click="deleteIndexing(data.indexing_id)"
class="ml-4"
>Delete</base-button
>
</div>
</div>
</template>
method: deleteIndexing: function() {
this.api.putData('indexing/'+store.state.journalId,
this.indexingList.indexing_id).then((res)=> { console.log(res.data) },(error)=>
{ console.log(error) }) },
Here in my api.js
.
putData (action, data) { let url = `${BASE_URL}` url += action + '.json' return
instance.put(url, data) },
And the Error which I'm facing.
Error: http://ipAddress/api/journals/v1/indexing/1.json' from origin 'http://localhost:8080' has been blocked by CORS policy: Method PUT is not allowed by Access-Control-Allow-Methods in preflight response.
I'm passing'indexing/'+store.state.journalId
as an argument againstputData
function's action parameter. That is showing in the IP address. But I have to pass indexing_id
as a second argument in the api
. I passed this.indexingList.indexing_id
as a second argument against putData
. But in the error it's showing 1.json
in the end. 1 is journal ID, not the indexing ID. It's not taking the second argument. indexing_id
has been written in the server side, just I have to pass in the API. But it's not taking, and I'm getting the error.