Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onLeaveClick() {
if(!this.state.spectating && this.isGameActive()) {
toastr.confirm('Your game is not finished, are you sure you want to leave?', {
onOk: () => {
this.props.sendGameMessage('leavegame');
this.props.closeGameSocket();
}
});
return;
}
this.props.sendGameMessage('leavegame');
this.props.closeGameSocket();
}
handleDeleteArea = () => {
const { area } = this.props;
const toastrConfirmOptions = {
onOk: () => {
this.props.removeUserArea(area);
}
};
toastr.confirm(`Are you sure you want to delete the area ${area.name}?
Deleting an area will delete all the subscriptions associated to it`, toastrConfirmOptions);
}
handleRemoveVisualization = () => {
const { widget, user, onWidgetRemove } = this.props;
const { token } = user;
const { id, name, dataset } = widget;
toastr.confirm(`Are you sure you want to remove the visualization: ${name}?`, {
onOk: () => {
deleteWidget(id, dataset, token)
.then(() => { onWidgetRemove(); })
.catch(({ message }) => toastr.error('Something went wrong deleting the widget', message));
}
});
}
const handleDeleteArea = () => {
toastr.confirm(`Are you sure you want to delete the area ${area.name}?
Deleting an area will delete all the subscriptions associated to it`,
{ onOk: () => { removeUserArea(area); } });
};
handleDeleteSubscription = () => {
const { subscription, token } = this.props;
const toastrConfirmOptions = {
onOk: () => {
this.setState({ loading: true });
deleteSubscription(subscription.id, token)
.then(() => {
this.props.onSubscriptionRemoved();
})
.catch(err => toastr.error('Error', err));
}
};
toastr.confirm('Are you sure you want to delete the subscription?', toastrConfirmOptions);
}