How to use the react-toastify.toast.POSITION 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 Sunshine168 / Full-stack-Blog / my-blog / src / util / post.js View on Github external
var result = await fetch(url, {
      method: "POST",
      headers: {
        Accept: "application/json",
        "Content-Type": "application/json"
      },
      body: JSON.stringify(body),
      credentials: CREDENTIALS
    });
    const data = await result.json();
    if (data.resCode !== 200) {
      if (data.resCode === 401) {
        emitter.emit("USER_INVALID");
      }
      toast.error(data.message, {
        position: toast.POSITION.TOP_RIGHT
      });
      throw new Error(data.message);
    }
    return {
      data
    };
  } catch (e) {
    return {
      message: e.message,
    };
  }
};
github LiveSplit / LiveSplitOne / src / index.tsx View on Github external
async function run() {
    try {
        const { LiveSplit } = await import("./ui/LiveSplit");

        ReactDOM.render(
            <div>
                
                
            </div>,
            document.getElementById("base"),
        );
    } catch (_) {
        alert(`Couldn't load LiveSplit One. \
You may be using a browser that doesn't support WebAssembly. \
Alternatively, you may be using an Adblocker like uBlock Origin. \
Those are known to block WebAssembly.`);
    }
}
github zweicoder / songbird / client / src / containers / PlaylistCustomizer / index.js View on Github external
notifySuccess = (message, duration = 1500) => {
    toast.success(message, {
      position: toast.POSITION.BOTTOM_RIGHT,
      className: 'toast-default',
      progressClassName: 'toast-progress-default',
      autoClose: duration,
    });
  };
  notifyError = (message, duration = 1500) => {
github evoluteur / evolutility-ui-react / src / components / widgets / Toolbar.js View on Github external
.catch(() => {
                    const errorMsg = 'Couldn\'t delete record.'
                    toast.error(errorMsg, {
                        position: toast.POSITION.TOP_RIGHT
                    });
                    this.setState({
                        error: {
                            message: errorMsg
                        }
                    })
                });
        }
github llambda / agilegps / src / client / components / session.js View on Github external
.then(() => {
        this.loggingIn = false;
        toast.success("Logged in", {
          position: toast.POSITION.BOTTOM_RIGHT,
          autoClose: 1500,
        });
      })
      .catch(err => {
github ThomasRoest / better-bookmarks / src / components / NewBookmarkForm / index.js View on Github external
handleSubmit = event => {
    event.preventDefault();
    const errors = this.validate();
    this.setState({ errors: errors || {} });
    if (errors) return;
    if (!errors) {
      const { title, url, tag, pinned } = this.state;
      const createdAt = Math.floor(Date.now() / 1000);
      const userId = this.props.auth.uid;
      const bookmark = { title, url, tag, pinned, createdAt, userId };
      this.props.createBookmark(bookmark);
      this.setState({ title: "", url: "", tag: "" });
      toast.success("Bookmark added!", {
        position: toast.POSITION.BOTTOM_CENTER
      });
    }
  };
github scorelab / OpenDF / OpenDF-UI / app / containers / AddProject / index.js View on Github external
.then((response) => {
      if (response.ok) {
        toast('Project added successfully !', {
          position: toast.POSITION.TOP_CENTER,
          autoClose: 3000,
          hideProgressBar: true,
          closeOnClick: true,
        });
      } else {
        toast.error('Error while saving the project! ', {
          position: toast.POSITION.TOP_CENTER,
          autoClose: 3000,
          hideProgressBar: true,
          closeOnClick: true,
        });
      }
    })
    .catch((error) => {
github Lambda-School-Labs / LabsPT1_bkwds / client / src / components / DashboardHome.js View on Github external
validateContactNumber = number =&gt; {
    if (number.length &lt; 10) {
      toast.error("Please enter a valid 10 digit phone number", {
        position: toast.POSITION.BOTTOM_RIGHT
      })
      this.setState({ contactNumber: "" })
      return false
    }
    if (isNaN(Number(number))) {
      toast.error("Please enter number without spaces or hyphens", {
        position: toast.POSITION.BOTTOM_RIGHT
      })
      this.setState({ contactNumber: "" })
      return false
    }
    return true
  }
github fkhadra / react-toastify / src / App.js View on Github external
componentDidMount() {
    toast("Default Notification !");
    toast.success("Success Notification !", {
      position: toast.POSITION.TOP_CENTER
    });
    toast.error("Error Notification !", {
      position: toast.POSITION.TOP_LEFT
    });
    toast.warn("Warning Notification !", {
      position: toast.POSITION.BOTTOM_LEFT
    });
    toast.info("Info Notification !", {
      position: toast.POSITION.BOTTOM_CENTER
    });
    toast("Custom Style Notification !", {
      position: toast.POSITION.BOTTOM_RIGHT,
      className: 'dark-toast',
      progressClassName: 'transparent-progress'
    });
  }