Skip to content

Instantly share code, notes, and snippets.

@nabanita-sarkar
Last active February 2, 2022 16:51
Show Gist options
  • Save nabanita-sarkar/ab5ad1c82a47e038be23223398db5ea0 to your computer and use it in GitHub Desktop.
Save nabanita-sarkar/ab5ad1c82a47e038be23223398db5ea0 to your computer and use it in GitHub Desktop.
import { message } from "antd"
const { isLoading, isError, mutateAsync } = useMutation(
"todo/create",
() => {
return axios.post("http://localhost:4000/todo/create", task)
},
{
onSuccess: res => {
dispatch(setTaskList(res.data.task_list))
message.success("New todo created")
},
onError: () => {
message.error("Some error occured")
},
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment