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, } ); }