-
Can anybody advise how to reset form's state controlled inputs on success? with simple toast i can do just .then(...) and i'm good, but there is a delay, no loading information. And now i have no idea how to toast.promise(
fetch('/api/post', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
}),
{
loading: 'Saving...',
success: <b>Published!</b>,
error: <b>Could not save.</b>,
}
)
// .then(() => {
// setTitle('')
// setContent('')
// })
// .catch((error) => {
// notifyNotOk()
// console.log(error)
// }) |
Beta Was this translation helpful? Give feedback.
Answered by
dorin-js
Aug 14, 2022
Replies: 1 comment
-
okay, problem solved. should of looked better in documentation |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dorin-js
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
okay, problem solved. should of looked better in documentation