Added Access-Control-Allow-Origin to Login POST header for CORS conformity
This commit is contained in:
parent
3f383e6527
commit
4524d95a7c
5 changed files with 31 additions and 15 deletions
19
motorradig/public/js/app.js
vendored
19
motorradig/public/js/app.js
vendored
|
|
@ -2714,9 +2714,17 @@ __webpack_require__.r(__webpack_exports__);
|
|||
password: this.password
|
||||
};
|
||||
console.log(formData);
|
||||
axios.post('http://localhost:8000/api/v1/auth/login', {
|
||||
var api_url = this.$store.state.app_url + '/api/v1/auth/login';
|
||||
console.log("Target URL:" + api_url);
|
||||
axios.post(api_url, {
|
||||
email: this.email,
|
||||
password: this.password
|
||||
}, {
|
||||
// Trying to manage CORS
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(function (res) {
|
||||
console.log("Login successful. Token=" + res.headers.authorization);
|
||||
_this.$store.state.user_token = res.headers.authorization;
|
||||
|
|
@ -2730,7 +2738,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
_this.$router.push('/');
|
||||
})["catch"](function (error) {
|
||||
console.log("Login unsuccessful."); //console.log(error)
|
||||
console.log("Login unsuccessful.");
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -2835,7 +2844,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
password_confirmation: this.password_confirmation
|
||||
};
|
||||
console.log(formData);
|
||||
axios.post('http://localhost:8000/api/v1/auth/register', {
|
||||
axios.post(this.$store.state.app_url + '/api/v1/auth/register', {
|
||||
name: this.name,
|
||||
email: this.email,
|
||||
password: this.password,
|
||||
|
|
@ -49220,8 +49229,8 @@ var store = new vuex__WEBPACK_IMPORTED_MODULE_1__["default"].Store({
|
|||
userlist: {},
|
||||
folders: {},
|
||||
selectedFolder: "default",
|
||||
//app_url:"http://www.programmschmiede.de"
|
||||
app_url: "http://www.localhost:8000"
|
||||
app_url: "http://www.programmschmiede.de" //app_url:"http://www.localhost:8000"
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue