[Vuejs]-Possible causes of '[Vue warn]: data functions should return an object:'

2👍

Changing the last line of interceptors.response.use() from return res to return res.data got rid of the error. So this is solved. Still, the view doesn’t update.
Thanks to @Alexander Staroselsky and @Dadboz for spending your time to have a look at my issue, though.

1👍

I don’t have the rights to comment yet, so here goes an answer.

I got this problem using the vue_element_admin system.

When a user logs in the Token is set in the login() function. The user details is than retrieved using the getInfo(). You then unpack the details in the user.js files and save it to the store.

The getInfo() then resolves with the returning of the user object.

THE THING IS:
The getInfo() gets used in the permissions.js file where it picks out the { roles } variable from returned user and uses it for to determine what can be viewed by the user.

If you remove the roles in the returning user object the system falls over with this error.

Leave a comment