Skip to content

Commit a9ca30f

Browse files
committed
feat(mod-ui): add MuMod channel switch integration flow
1 parent 523e4a7 commit a9ca30f

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

  • MaiChartManager/Front/src/views/ModManager

MaiChartManager/Front/src/views/ModManager/refs.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import api from "@/client/api";
22
import { useAsyncState } from '@vueuse/core';
33
import { computed, ref } from 'vue';
4+
import { debounce } from 'perfect-debounce';
45
import { ConfigDto } from "@/client/apiGen";
5-
import { modInfo } from "@/store/refs";
6+
import { globalCapture, modInfo, updateModInfo } from "@/store/refs";
67
import { compareVersions } from "./shouldShowUpdateController";
78

89
// 请求参数 ref
@@ -70,7 +71,14 @@ export const updateAquaMaiConfig = async (forceDefault = false, skipSignatureChe
7071
export const muModChannel = computed(() => modInfo.value?.muModChannel ?? 'slow');
7172
export const isBothModsPresent = computed(() => !!modInfo.value?.isBothModsPresent);
7273

73-
export const updateMuModChannel = async (channel: string) => {
74-
await api.SetMuModChannelAndEnsureCache({ channel });
75-
await updateAquaMaiConfig();
74+
const updateMuModChannelImpl = async (channel: string) => {
75+
try {
76+
await api.SetMuModChannelAndEnsureCache({ channel });
77+
await updateModInfo();
78+
await updateAquaMaiConfig();
79+
} catch (e: any) {
80+
globalCapture(e, 'mod.cacheFailed');
81+
}
7682
};
83+
84+
export const updateMuModChannel = debounce(updateMuModChannelImpl, 1500);

0 commit comments

Comments
 (0)