handle bookmark delete loading state
This commit is contained in:
@@ -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 })
|
||||
|
Reference in New Issue
Block a user