I'm submitting a Post request using Axios, and I want to give the user some confirmation if the request is successful. However, I have no use for the response
variable, so I get an eslint
error. How to fix this?
axios.post('/api/option.json', {
choices: myChoices
})
.then(response => {
alert('Form was submitted successfully')
})
Error:
Module Error (from ./node_modules/eslint-loader/index.js):
error: 'response' is defined but never used (no-unused-vars) at src/components/Options.vue:78:15
EDIT (April 2020): Oops, looks like this question now has 1k views but 0 upvotes. I'm guessing I wrote a tantalizing title but the question isn't helping people. Please comment if I should rename this or link to a better question?
alert()
, you can add areturn response;
. I've seen returning the response or error of an axios promise many times in other people's code; even if you don't necessarily have to return anything or use the returned value - this may get rid of your error