Fixed cronSyncArtifact failed issue

This commit is contained in:
Peng-YM
2022-05-18 11:06:40 +08:00
parent 5954ff0a58
commit 48d533af83
4 changed files with 120 additions and 149 deletions

View File

@@ -322,16 +322,15 @@ export default {
},
async syncAllArtifacts() {
this.$store.commit("SET_LOADING", true);
try {
const {data} = await axios.get(`/cron/sync-artifacts`);
const {failed} = data;
if (failed.length > 0) {
this.$store.commit("SET_ERROR_MESSAGE", `部分配置(${failed.map(artifact => artifact.name).join(", ")})同步失败,请查看日志!`);
} else {
this.$store.commit("SET_SUCCESS_MESSAGE", `Gist 同步生成节点成功!`);
}
await axios.get(`/cron/sync-artifacts`);
await this.$store.dispatch("FETCH_ARTIFACTS");
this.$store.commit("SET_SUCCESS_MESSAGE", `Gist 同步生成节点成功!`);
} catch (err) {
this.$store.commit("SET_ERROR_MESSAGE", `Gist 同步生成节点失败!${err}`);
} finally {
this.$store.commit("SET_LOADING", false);
}
},