// 我如何使用 toastify 的承诺,就像我想在获取数据时显示微调器然后消息成功或失败
// 但我在下面的代码中遇到错误
const fetch = () => { axios
.get("https://restcountries.com/v2/name/india")
.then((res) => {
toast.promise({
pending:"pending",
success:"success",
error:"rejected"
} )
console.log(res);
})
.catch((err) => {
toast.error(" failed", {
position: "top-center",
autoClose: 2000,
hideProgressBar: true,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined
});
});
};