Search code examples
djangovue.jsdjango-rest-frameworkaxiosdjango-rest-auth

Django/Vue braces added to request method after logout


I have a basic user management project that I'm using off of which to scaffold other projects. It is a Vue CLI 3 front end and Django/Django REST Framework/Django REST Auth back end. The project I'm posting here uses sqllite but it can relatively easily be converted to another db.

Here is the link to the full repo for anyone who is willing to download to try to replicate my issue: https://github.com/JVP3122/user-project

I'm having a very strange problem in that when I log out of the site and then try to log back in directly from the same page it seems that axios is adding the payload to the beginning of the request method.

For example, in the images found in the post I put up in Imgur (https://i.sstatic.net/R3eWz.jpg) the user name is simply "test" with the password "password", and when I try to log back in after logging out the subsequent login attempt is no longer a POST route, but instead a {}POST route. If I try again, the route becomes a {"USERNAME":"TEST","PASSWORD":"PASSWORD"}POST method.

I've tried looking at the config in the axios request interceptor, looking at the dispatch method in the rest_framework source code, and I can't figure out what is going on or how to solve this. It's a small bug that doesn't take away from the rest of the functionality, but it's a bug nonetheless.

Any help would be appreciated.


Solution

  • Did you try:

    • setting up new project (npm reinstall, clear npm cache etc..)
    • using axios.post instead of custom made HTTP object

    I don't see anything in the backend that could interrupt the request and customise method as described in the original post. Hopefully one of these two options above will resolve it.