mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 02:09:00 +08:00
修复UI不刷新的bug
This commit is contained in:
parent
bb8bac760e
commit
64709b6610
@ -17,7 +17,6 @@ const store = new Vuex.Store({
|
|||||||
collections: {},
|
collections: {},
|
||||||
artifacts: {},
|
artifacts: {},
|
||||||
env: {},
|
env: {},
|
||||||
|
|
||||||
settings: {}
|
settings: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -70,6 +69,11 @@ const store = new Vuex.Store({
|
|||||||
state.env = resp.data;
|
state.env = resp.data;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
async FETCH_SETTINGS({state}) {
|
||||||
|
return axios.get("/settings").then(resp => {
|
||||||
|
state.settings = resp.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
// update subscriptions
|
// update subscriptions
|
||||||
async UPDATE_SUBSCRIPTION({dispatch}, {name, sub}) {
|
async UPDATE_SUBSCRIPTION({dispatch}, {name, sub}) {
|
||||||
return axios.patch(`/sub/${name}`, sub).then(() => {
|
return axios.patch(`/sub/${name}`, sub).then(() => {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<v-container>
|
<v-container>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title>
|
<v-card-title>
|
||||||
配置
|
同步配置
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<!-- <v-btn icon>-->
|
<!-- <v-btn icon>-->
|
||||||
<!-- <v-icon>mdi-cloud-circle</v-icon>-->
|
<!-- <v-icon>mdi-cloud-circle</v-icon>-->
|
||||||
@ -279,7 +279,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setArtifactType(type) {
|
setArtifactType(type) {
|
||||||
this.newArtifactType = type;
|
this.newArtifact.type = type;
|
||||||
this.newArtifact.source = "";
|
this.newArtifact.source = "";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
<v-icon small>mdi-cloud</v-icon>
|
<v-icon small>mdi-cloud</v-icon>
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
最近同步于:{{getSyncTime()}}
|
最近同步于:{{syncTime}}
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
@ -66,14 +66,25 @@ export default {
|
|||||||
axios.get(`/settings`).then(resp => {
|
axios.get(`/settings`).then(resp => {
|
||||||
this.settings.gistToken = resp.data.gistToken;
|
this.settings.gistToken = resp.data.gistToken;
|
||||||
this.settings.githubUser = resp.data.githubUser;
|
this.settings.githubUser = resp.data.githubUser;
|
||||||
|
this.settings.syncTime = resp.data.syncTime;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
syncTime(){
|
||||||
|
if (this.settings.syncTime) {
|
||||||
|
return format(this.settings.syncTime, "zh_CN");
|
||||||
|
} else {
|
||||||
|
return "从未同步";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
save() {
|
save() {
|
||||||
axios.patch(`/settings`, this.settings);
|
axios.patch(`/settings`, this.settings);
|
||||||
this.$store.commit("SET_SUCCESS_MESSAGE", `保存成功!`);
|
this.$store.commit("SET_SUCCESS_MESSAGE", `保存成功!`);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
sync(action) {
|
sync(action) {
|
||||||
if (!this.settings.gistToken) {
|
if (!this.settings.gistToken) {
|
||||||
this.$store.commit("SET_ERROR_MESSAGE", "未设置GitHub Token!");
|
this.$store.commit("SET_ERROR_MESSAGE", "未设置GitHub Token!");
|
||||||
@ -97,14 +108,9 @@ export default {
|
|||||||
store.dispatch("FETCH_COLLECTIONS").catch(() => {
|
store.dispatch("FETCH_COLLECTIONS").catch(() => {
|
||||||
showError(`无法拉取组合订阅列表!`);
|
showError(`无法拉取组合订阅列表!`);
|
||||||
});
|
});
|
||||||
},
|
store.dispatch("FETCH_ARTIFACTS").catch(() => {
|
||||||
|
showError(`无法拉取同步配置!`);
|
||||||
getSyncTime() {
|
});
|
||||||
if (this.settings.syncTime) {
|
|
||||||
return format(this.settings.syncTime, "zh_CN");
|
|
||||||
} else {
|
|
||||||
return "从未同步";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user