每當我單擊刪除按鈕時,它都可以正常工作,但我沒有得到像“成功刪除”這樣的輸出,它的顯示。然后是未定義的。const deleteThisCategory = (CategoryId) => { deleteCategory(CategoryId, user._id, token).then(data => { if (data.error) { console.log(data.error); } else { preload(); } });};這是刪除類別 API 調用export const deleteCategory = (userId, categoryId , token) => { fetch(`${API}/category/${categoryId}/${userId}`, { method: "DELETE", headers: { Authorization: `Bearer ${token}`, "Content-Type":"application/json" }, }) .then(response => { return response.json(); }) .catch(err => console.log(err));};
代碼正在運行,但我沒有得到所需的輸出
瀟湘沐
2023-05-25 17:38:14