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