Ensure credentials are included in RSVP request
This commit is contained in:
@@ -48,27 +48,29 @@ class RsvpButton extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validateRsvp = () => {
|
validateRsvp = () => {
|
||||||
fetch(`rsvp/${this.rsvpInput.value}`)
|
fetch(`rsvp/${this.rsvpInput.value}`, {
|
||||||
.then(data => {
|
method: 'get',
|
||||||
if (data.status === 200) {
|
credentials: 'include',
|
||||||
location.href = data.url;
|
}).then(data => {
|
||||||
} else {
|
if (data.status === 200) {
|
||||||
this.setState({
|
location.href = data.url;
|
||||||
inputInvalid: true,
|
} else {
|
||||||
inputInvalidMsg: 'Sorry, that RSVP code is invalid.',
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({
|
|
||||||
inputInvalid: false,
|
|
||||||
});
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
this.setState({
|
this.setState({
|
||||||
inputInvalid: true,
|
inputInvalid: true,
|
||||||
inputInvalidMsg: 'Sorry, there was a problem validating your RSVP code, please try again later.',
|
inputInvalidMsg: 'Sorry, that RSVP code is invalid.',
|
||||||
});
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
inputInvalid: false,
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.setState({
|
||||||
|
inputInvalid: true,
|
||||||
|
inputInvalidMsg: 'Sorry, there was a problem validating your RSVP code, please try again later.',
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user