Last active
February 2, 2022 16:51
-
-
Save nabanita-sarkar/ab5ad1c82a47e038be23223398db5ea0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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