Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const notificationMiddleware = () => next => (action) => {
if (!action.type) return next(action);
if (action.type.indexOf('SUCCESS') > -1) {
// console.log(action.type);
NotificationManager.success(action.payload.message, SUCCESS);
} else if (action.type.indexOf('FAILED') > -1) {
// console.log(action.type);
NotificationManager.error(action.payload.message, ERROR);
}
return next(action);
};
render={(subProps) => {
// find the component based on the id
const { id } = subProps.match.params;
const component = props.components.find(c => {
return c.id === id;
});
if (!component) {
NotificationManager.error('Component not found.');
subProps.history.push('/admin/components');
}
return <form>;
}}
/></form>
render={(subProps) => {
// find the instance based on the id
const { id } = subProps.match.params;
const incident = props.incidents.find(i => {
return i.id === id;
});
if (!incident) {
NotificationManager.error('Incident not found.');
return ;
}
return ;
}}
/>
componentDidUpdate() {
if (this.props.createMessage === 'success') {
NotificationManager.success(`User ${this.state.createUsername} created.`)
} else if (this.props.createMessage !== '') {
NotificationManager.error(this.props.createMessage)
}
this
.props
.cleanCreateUserMessage()
}
createUserCheckGroup(rowInfo, choosenGroups) {
componentDidUpdate() {
if (this.props.createMessage === 'success') {
NotificationManager.success(`LabelTree created.`)
} else if (this.props.createMessage !== '') {
NotificationManager.error(this.props.createMessage)
}
this
.props
.cleanLabelMessages()
}
render() {
componentDidUpdate() {
if (this.props.createMessage === 'success') {
NotificationManager.success(`Group ${this.state.createGroupName} created.`)
} else if (this.props.createMessage !== '') {
NotificationManager.error(this.props.createMessage)
}
this
.props
.cleanGroupCreateMessage()
}
render() {
componentDidUpdate() {
if (this.props.deleteMessage === 'success') {
NotificationManager.success(`Group with id ${this.state.clickedGroup} deleted.`)
} else if (this.props.deleteMessage !== '') {
NotificationManager.error(this.props.deleteMessage)
}
this
.props
.cleanGroupDeleteMessage()
}
componentDidUpdate() {
if (this.props.deleteMessage === 'success') {
NotificationManager.success(`User successfully deleted.`)
} else if (this.props.deleteMessage !== '') {
NotificationManager.error(this.props.deleteMessage)
}
this
.props
.cleanDeleteUserMessage()
if (this.props.updateMessage === 'success') {
NotificationManager.success(`User successfully updated.`)
} else if (this.props.updateMessage !== '') {
NotificationManager.error(this.props.updateMessage)
}
this
.props
.cleanUpdateUserMessage()
}
validateInputAndUpdateBackend(original, updateUser) {
.catch(err => {
NotificationManager.error(err.message);
this.setState({ saving: false });
});
onSendConfirmationLink = async (e) => {
e.preventDefault();
try {
const resp = await apiGateway.get(`/subscriptions/${this.state.subscriptionObj.id}/send_confirmation_link`);
NotificationManager.success(resp.message);
}
catch (err) {
NotificationManager.error(err.message);
}
}