แก้ fetch เเล้วสถานะไม่เปลี่ยน
This commit is contained in:
parent
5e471aafc1
commit
0a8f34ab86
1 changed files with 10 additions and 13 deletions
|
|
@ -62,7 +62,7 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
await http
|
||||
.post(config.API.backup + "/create")
|
||||
.then(async (res) => {
|
||||
await backupRunningList();
|
||||
await backupRunningList(fetchListBackup);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
|
|
@ -99,24 +99,24 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
recordRestore.value[res.data] = tempValue;
|
||||
}
|
||||
|
||||
restoreRunningList();
|
||||
restoreRunningList(fetchListBackup);
|
||||
});
|
||||
}
|
||||
|
||||
async function backupRunningList() {
|
||||
async function backupRunningList(cb: () => void) {
|
||||
await http
|
||||
.get<BackUpRunning[]>(config.API.backup + "/backup-running-list")
|
||||
.then(async (res) => {
|
||||
backupRunTotal.value = res.data.length;
|
||||
|
||||
if (backupRunTotal.value == 0) {
|
||||
fetchListBackup();
|
||||
if (backupRunTotal.value === 0 && prevBackupRunTotal.value !== 0) {
|
||||
cb();
|
||||
prevBackupRunTotal.value = backupRunTotal.value;
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(async () => {
|
||||
backupRunningList();
|
||||
backupRunningList(cb);
|
||||
}, 3000);
|
||||
|
||||
if (prevBackupRunTotal.value !== backupRunTotal.value) {
|
||||
|
|
@ -142,22 +142,19 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
});
|
||||
}
|
||||
|
||||
async function restoreRunningList() {
|
||||
async function restoreRunningList(cb: () => void) {
|
||||
await http
|
||||
.get<BackUpRunning[]>(config.API.backup + "/restore-running-list")
|
||||
.then(async (res) => {
|
||||
console.log(res.data);
|
||||
|
||||
restoreRunTotal.value = res.data.length;
|
||||
|
||||
if (restoreRunTotal.value == 0) {
|
||||
fetchListBackup();
|
||||
if (restoreRunTotal.value === 0 && prevRestoreRunTotal.value !== 0) {
|
||||
cb();
|
||||
prevRestoreRunTotal.value = restoreRunTotal.value;
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(async () => {
|
||||
restoreRunningList();
|
||||
restoreRunningList(cb);
|
||||
}, 3000);
|
||||
|
||||
if (prevRestoreRunTotal.value !== restoreRunTotal.value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue