Skip to content
Advertisement

TypeError: axiosCookieJarSupport is not a function, works in Node.JS but not .vue pages?

I have a function to authenticate with a website, it works when I run it in a basic node.js script but it does not work when run from a .vue page (using NuxtJS framework).

When I run it in a .vue page it receives errors stating TypeError: axiosCookieJarSupport is not a function

Examples below.

Working code in basic .js file:

JavaScript

Code in .vue page that is not working:

JavaScript

I’ve tried moving the const axiosCookieJarSupport = require('axios-cookiejar-support').default into the function but it made no difference.

Any help would be much appreciated.

Advertisement

Answer

Fixed by updating my nuxt.config.js file with:

JavaScript

The code in the .vue page is now:

JavaScript

It appears to now be storing the session and I can use session on subsequent api calls.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement