mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 05:30:46 +08:00
fix(ume): cancel alarm subscription with DELETE and surface failures
Use DELETE delete-subscription, refresh token before cancel, recover orphan subs on establish, and keep local state when UME delete fails. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
4f8735a83f
commit
a8b359f60d
4 changed files with 110 additions and 19 deletions
|
|
@ -117,9 +117,15 @@ export function UmePage({ toastOk, toastError }: UmePageProps) {
|
|||
const subscriptionCancelMutation = useMutation({
|
||||
mutationFn: cancelUmeAlarmSubscription,
|
||||
onMutate: () => setSubscriptionOpError(""),
|
||||
onSuccess: async () => {
|
||||
setSubscriptionOpError("");
|
||||
toastOk?.("告警订阅已取消");
|
||||
onSuccess: async (res) => {
|
||||
if (res?.active) {
|
||||
const msg = "取消订阅失败:UME 侧订阅可能仍存在,请查看错误详情后重试";
|
||||
setSubscriptionOpError(msg);
|
||||
toastError?.(msg);
|
||||
} else {
|
||||
setSubscriptionOpError("");
|
||||
toastOk?.("告警订阅已取消");
|
||||
}
|
||||
await queryClient.invalidateQueries({ queryKey: ["umeAlarmSubscription"] });
|
||||
await queryClient.invalidateQueries({ queryKey: ["umeSyncStatus"] });
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue