Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refacto(toast): make a shortcut for calling error/success toast #1401

Open
hthieu1110 opened this issue Nov 20, 2024 · 0 comments
Open

refacto(toast): make a shortcut for calling error/success toast #1401

hthieu1110 opened this issue Nov 20, 2024 · 0 comments
Labels

Comments

@hthieu1110
Copy link
Collaborator

In the code, we can see in many place:

try {
} catch (err) {
      console.error(err);
      if (err instanceof Error) {
        setToast({ 
          mode: "normal",
          type: "error",
          title: "Failed to ...",
          message: err.message,
        }}
}

Suggestion: we can simplify this like:

try {
} catch (err) {
    setToastError(err) // which does the logic above
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants