handle bookmark delete loading state

This commit is contained in:
2025-05-07 16:57:09 +01:00
parent e87a6586b6
commit 9f00c9bb29
7 changed files with 107 additions and 31 deletions

View File

@@ -9,9 +9,11 @@ function useDeleteBookmark() {
return useMutation({
mutationFn: ({ bookmark }: { bookmark: Bookmark }) =>
fetchApi(`/bookmark/${bookmark.id}`, {
method: "DELETE",
}),
new Promise((resolve) => setTimeout(resolve, 5000)).then(() =>
fetchApi(`/bookmark/${bookmark.id}`, {
method: "DELETE",
}),
),
onError: (error) => {
if (error instanceof UnauthenticatedError) {
navigate({ to: "/login", replace: true })