-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add retry mechanism for publishing posts on the UC end (#7171)
#### What type of PR is this? /area ui /kind improvement /milestone 2.20.x #### What this PR does / why we need it: 为 UC 端发布文章的操作添加重试机制,防止出现因为锁导致的保存失败问题。 #### Which issue(s) this PR fixes: Fixes #7139 #### Does this PR introduce a user-facing change? ```release-note 为 UC 端发布文章的操作添加重试机制,防止出现因为锁导致的保存失败问题。 ```
- Loading branch information
Showing
3 changed files
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
ui/uc-src/modules/contents/posts/composables/use-post-publish-mutate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ucApiClient } from "@halo-dev/api-client"; | ||
import { useMutation } from "@tanstack/vue-query"; | ||
|
||
export function usePostPublishMutate() { | ||
return useMutation({ | ||
mutationKey: ["uc:publish-post"], | ||
mutationFn: async ({ name }: { name: string }) => { | ||
return await ucApiClient.content.post.publishMyPost( | ||
{ | ||
name: name, | ||
}, | ||
{ | ||
mute: true, | ||
} | ||
); | ||
}, | ||
retry: 3, | ||
}); | ||
} |