Minor bug fixed

This commit is contained in:
Peng-YM 2020-09-24 15:12:45 +08:00
parent 3b57b895e2
commit 4b25874dc6
2 changed files with 10 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -3,15 +3,15 @@
class="mb-4 ml-4 mr-4 mt-4" class="mb-4 ml-4 mr-4 mt-4"
> >
<v-card-title> <v-card-title>
设置 云同步
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-icon small>settings</v-icon> <v-icon small>cloud</v-icon>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-text-field <v-text-field
label="GitHub Token" label="GitHub Token"
hint="填入GitHub Token" hint="填入GitHub Token"
:value="settings.gistToken" v-model="settings.gistToken"
clearable clear-icon="clear" clearable clear-icon="clear"
/> />
</v-card-text> </v-card-text>
@ -38,7 +38,7 @@ export default {
}, },
created() { created() {
axios.get(`/settings`).then(resp => { axios.get(`/settings`).then(resp => {
this.settings = resp.data; this.settings.gistToken = resp.data.gistToken;
}); });
}, },
methods: { methods: {
@ -52,10 +52,11 @@ export default {
return; return;
} }
this.save(); this.save();
axios.get(`/backup?action=${action}`).then(() => { axios.get(`/backup?action=${action}`).then(resp => {
this.$store.commit("SET_SUCCESS_MESSAGE", `${action === 'upload' ? "备份" : "还原"}成功!`); if (resp.data.status === 'success')
}).catch(err => { this.$store.commit("SET_SUCCESS_MESSAGE", `${action === 'upload' ? "备份" : "还原"}成功!`);
this.$store.commit("SET_ERROR_MESSAGE", `备份失败!${err}`); else
this.$store.commit("SET_ERROR_MESSAGE", `备份失败!${resp.data.message}`);
}); });
}, },
} }