const handleUpdate=()=>{ toast.promise( axiosInstance .patch( `api/business/${businessId}/department/${department.id}`, values, { headers: { "Content-Type": "application/json", }, } ) .then((res) => { setDepartments(res.data.departments); }) .finally(() => { setIsLoading(false); }), { loading: "updating the department", success: "Department is updated", error: (err) => err?.response?.data?.message ? err?.response.data?.message : err?.response?.data, } ); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter