How to use the react-toastify.toast.error function in react-toastify

To help you get started, we’ve selected a few react-toastify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github liorchamla / formation-api-platform-react / assets / js / pages / RegisterPage.jsx View on Github external
// TODO : Flash success
      toast.success(
        "Vous êtes désormais inscrit, vous pouvez vous connecter !"
      );
      history.replace("/login");
    } catch (error) {
      const { violations } = error.response.data;

      if (violations) {
        violations.forEach(violation => {
          apiErrors[violation.propertyPath] = violation.message;
        });
        setErrors(apiErrors);
      }
      toast.error("Des erreurs dans votre formulaire !");
    }
  };
github Kitware / paraview-glance / Sources / controls / FileLoader / index.js View on Github external
.catch((error) => {
        if (error) {
          toast.error(Messages.LoadFailure);
        }
        // No reader found
        if (files.length === 1) {
          this.setState({ file: files[0] });
        } else {
          this.setState({ file: null });
        }
      });
  }
github theRoughCode / WatsMyMajor / react-ui / src / components / account / Register.jsx View on Github external
const { code } = await response.json();
        const ERROR_USERNAME_EXISTS = 100;
        const ERROR_EMAIL_EXISTS = 200;
        const ERROR_SERVER_ERROR = 400;

        this.setState({ loading: false });

        switch (code) {
        case ERROR_USERNAME_EXISTS:
          this.setState({ usernameError: 'Username already exists' });
          return;
        case ERROR_EMAIL_EXISTS:
          this.setState({ emailError: 'Email already exists' });
          return;
        case ERROR_SERVER_ERROR:
          toast.error('Failed to create account. Please contact an administrator.');
          return;
        default:
          toast.error('Failed to create account. Please contact an administrator.');
          return;
        }
      } else {
        this.setState({ registered: true, loading: false });
      }
    } catch (err) {
      toast.error('Failed to create account. Please contact an administrator.');
      console.error(err);
    }
  }
github jhipster / generator-jhipster / generators / client / templates / react / src / main / webapp / app / config / notification-middleware.ts View on Github external
}).catch(error => {
    if (action.meta && action.meta.errorMessage) {
      toast.error(action.meta.errorMessage);
    }
    return Promise.reject(error);
  });
};
github SwitchQL / SwitchQL / src / electron / client / main.jsx View on Github external
ipcRenderer.on(events.APP_ERROR, () => {
      this.setState(prev => ({
        isLoading: false,
        formDisabled: false,
        exportDisabled: !(prev.schema && prev.mutations && prev.queries)
      }));
      toast.error(`Could not connect to database.
      			 Please check your connection
      			 string and try again`);
    });
github AnuraConfig / anura-server / src / pages / NewServicePage.js View on Github external
mutationRendering = (data, error) => {
        const key = this.props.service ? "updateService" : "newService"
        if (data && data[key] && data[key].success) {
            toast.success(`service ${this.props.service ? "updated" : "added"}`)
            this.props.history.push('/')
        }
        if (error) {
            if (data)
                toast.error(data[key].error)
            else
                toast.error(error.message)
        }
    }
    render() {
github Lambda-School-Labs / LabsPT1_bkwds / client / src / redux / actions / auth.js View on Github external
.catch(error => {
      dispatch({
        type: REGISTRATION_FAILURE
      })
      toast.error(error.message, {
        position: toast.POSITION.BOTTOM_RIGHT
      })
    })
}
github BigDataBoutique / ElastiQuill / admin-frontend / src / pages / Backup.js View on Github external
async _onClick(apiCall) {
    try {
      await apiCall();
    } catch (err) {
      toast.error(err.message);
    }
  }
}
github Inist-CNRS / ezmaster / ezmaster-front / src / tab-instances / InstanceBtnTrash.js View on Github external
err => {
          if (err) {
            toast.error(
              <div>
                Instance featching detail error: <br> {err}
              </div>
            );
          }
        }
      );
github Lambda-School-Labs / LabsPT1_bkwds / client / src / components / Maps / createTrip / index.js View on Github external
saveValidate = () => {
    const { startDate, endDate, title, markers } = this.state
    if (!startDate || !endDate) {
      toast.error("Date not provided", {
        position: toast.POSITION.BOTTOM_RIGHT
      })
      return false
    }
    if (title === "") {
      toast.error("Title not provided", {
        position: toast.POSITION.BOTTOM_RIGHT
      })
      return false
    }
    if (!markers.length) {
      toast.error("Set at least 1 checkpoint", {
        position: toast.POSITION.BOTTOM_RIGHT
      })
      return false
    }
    return true
  }