You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering what to give notify.promise when using async/await where I need to access the result. Could you give us an example?
Example:
constonSubmit=async(data)=>{const{ key }=awaitcreateProject(data)// Now here comes the question:notify.promise('What would I possibly use here',{loading: 'Loading',success: 'Got the data',error: 'Error when fetching',})push(`/projects/${key}`)}
The text was updated successfully, but these errors were encountered:
Sometimes all you need is to type your question down and your thinking barrier is gone.
It's as simple as that:
constonSubmit=async(data)=>{constpromise=createProject(data)const{ key }=awaitpromisenotify.promise(promise,{loading: 'Loading',success: 'Got the data',error: 'Error when fetching',})push(`/projects/${key}`)
Yes you're right! That's how you do it. One thing I'd add is that you should call toast.promise first so the loading animation will work.
constonSubmit=async(data)=>{constpromise=createProject(data)toast.promise(promise,{loading: 'Loading',success: 'Got the data',error: 'Error when fetching',})const{ key }=awaitpromisepush(`/projects/${key}`)}
I'm wondering what to give
notify.promise
when using async/await where I need to access the result. Could you give us an example?Example:
The text was updated successfully, but these errors were encountered: