Pochwar / laravel-vue-spa

82 stars 31 forks source link

login registration error #20

Open atta1234 opened 5 years ago

atta1234 commented 5 years ago

i download the project and run have database migrated everything work,,run php artisan server
.but when i click login i m getting this error {message: "The POST method is not supported for this route. Supported methods: GET, HEAD.",…}

app.js:1458 POST http://127.0.0.1:8000/undefined/api/auth/login?email=user@test.com&password=secret 405 (Method Not Allowed)

Pochwar commented 5 years ago

Hello,

There is a problem in the URL, it contains "undefined" when it shouldn't.

Axios has a default base URL defined to make the requests. It can be found in resources/js.app.js line 21. As you can see, it uses the variable "process.env.MIX_APP_URL" and I think this variable is undefined and breaks the URL.

This variable "process.env.MIX_APP_URL" is retrieved when you compile the front (with 'npm run dev', 'npm run prod', 'npm run watch', ...) from the '.env' file at line 41.

This variable is set like this : MIX_APP_URL="${APP_URL}". That means it takes the value of the variable "APP_URL" that id define above.

So make sure that "APP_URL" in your ".env" file is set with the value given by the 'php artisan serve' command (in your case: "http://127.0.0.1:8000")

atta1234 commented 5 years ago

here is the same question posted from someone and it work but why that dynamic url not working https://stackoverflow.com/questions/56962901/laravel-websanova-vue-auth-login-register-returning-undefined-url

secondly in login function you have used this var redirect = this.$auth.redirect() from where it's get the value or where is the function defined can you explain please

ssenol commented 5 years ago

after install: