Skip to content

Feature: toast.promise would show messages coming from Promise if any #111

@shinauri

Description

@shinauri
const promiseTimeout = 5000;
const durationTimeout = 3000;

toast.promise(
      new Promise((resolve, reject) => {
        setTimeout(() => {
          const success = true
          if (success) {
            resolve("Operation successful!")
          } else {
            reject("Something went wrong!")
          }
        }, promiseTimeout )
      }),
      {
        loading: "Loading data...",
        success: "Data loaded successfully!", // should show "Operation successful!"
        error: "Failed to load data!", // should show  "Something went wrong!"
        toastOptions: { duration: durationTimeout }
      }
    )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions