
or first check your code, than try to find a solution using google.
First at all — I am not the only one. And second — how stupid not to investigate further why something does not work and google around for a solution.
I guess in 99 percent of all cases the problem is sitting right in front of your monitor — me myself and I.
So next time, you have a problem. First and second look into your code and do not google around.
Having a type, this should not happen — but I don’t like types in JavaScript.
The short story is. I use axios in my VueJS application to request my backend and also want to cancel request that has not been fullfilled but should be aborted. So I use the mysterios method CancelToken.
import axios from 'axios'
const createCancelToken = () => axios.CancelToken.source()
But this give you an object containing the token, not the token itself. So using it in a request should be done like this.
const cancelToken = createCancelToken()
axios.get('/user/12345', {
cancelToken: cancelToken.token
}).catch(function (thrown) {
if (axios.isCancel(thrown)) {
console.log('Request canceled', thrown.message);
} else {
// handle error
}
});
And what did I instead? My fault was to forget the .token, and that leads to what?
The title of the story. ;-)
Lesson learned for me.
That also shows why naming is so important in programming.
