I'm making a Vue project and, when making an axios.post
call in my vue file, I get POST http://127.0.0.1:8000/admin/auth/user/ net::ERR_CONNECTION_REFUSED
as an error on the site and a Uncaught (in promise) Error: Network Error at createError (createError.js?2d83:16) at XMLHttpRequest.handleError (xhr.js?b50d:84)
error right after.
The login method I'm attempting to use that's giving the errors:
login() { axios.post('http://127.0.0.1:8000/admin/auth/user/', { username: this.username, password: this.password, }) .then(resp => { this.token = resp.data.token; console.log(this.token) localStorage.setItem('user-token', resp.data.token) }) }
The full error:
POST http://127.0.0.1:8000/admin/auth/user/ net::ERR_CONNECTION_REFUSED dispatchXhrRequest @ xhr.js?b50d:177 xhrAdapter @ xhr.js?b50d:13 dispatchRequest @ dispatchRequest.js?5270:52 Promise.then (async) request @ Axios.js?0a06:61 Axios.<computed> @ Axios.js?0a06:87 wrap @ bind.js?1d2b:9 login @ Header.vue?0418:44 $data.token.Object.onClick._cache.<computed>._cache.<computed> @ Header.vue?0418:17 callWithErrorHandling @ runtime-core.esm-bundler.js?5c40:154 callWithAsyncErrorHandling @ runtime-core.esm-bundler.js?5c40:163 invoker @ runtime-dom.esm-bundler.js?830f:333
I've looked around in Django documentation and around stackoverflow for a couple hours and haven't found any solutions. Any assistance, critiques, comments, or questions would be appreciated. I'd be more than happy to provide any additional information needed.
https://stackoverflow.com/questions/67310120/how-do-i-fix-post-http-127-0-0-18000-admin-auth-user-neterr-connection-re April 29, 2021 at 10:07AM
没有评论:
发表评论