Sprinkle credentials: same-origin on authenticated fetches
This commit is contained in:
parent
aae5c1ca32
commit
11e93a18b3
@ -74,7 +74,8 @@ class BuildingEdit extends Component {
|
||||
body: JSON.stringify(this.state),
|
||||
headers:{
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
},
|
||||
credentials: 'same-origin'
|
||||
}).then(
|
||||
res => res.json()
|
||||
).then(function(res){
|
||||
|
@ -17,7 +17,8 @@ class MyAccountPage extends Component {
|
||||
this.setState({error: undefined});
|
||||
|
||||
fetch('/logout', {
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
credentials: 'same-origin'
|
||||
}).then(
|
||||
res => res.json()
|
||||
).then(function(res){
|
||||
@ -32,7 +33,7 @@ class MyAccountPage extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.props && this.props.user) {
|
||||
if (this.props.user && !this.props.user.error) {
|
||||
return (
|
||||
<article>
|
||||
<section className="main-col">
|
||||
|
@ -41,14 +41,17 @@ class SignUp extends Component {
|
||||
body: JSON.stringify(this.state),
|
||||
headers:{
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
},
|
||||
credentials: 'same-origin'
|
||||
}).then(
|
||||
res => res.json()
|
||||
).then(function(res){
|
||||
if (res.error) {
|
||||
this.setState({error: res.error})
|
||||
} else {
|
||||
fetch('/users/me').then(
|
||||
fetch('/users/me', {
|
||||
credentials: 'same-origin'
|
||||
}).then(
|
||||
(res) => res.json()
|
||||
).then(
|
||||
(user) => this.props.login(user)
|
||||
|
Loading…
Reference in New Issue
Block a user