Refactor async logging to synchronous; improve error handling consistency across modules.
This commit is contained in:
@@ -47,28 +47,26 @@ export class Controller {
|
||||
});
|
||||
}
|
||||
|
||||
loadLogLocaleConfig() {
|
||||
return fetch(PUBLIC_URL + "/log_localization")
|
||||
.then(response => response.json())
|
||||
.then(json => json as LogLocalisation)
|
||||
.then(loglocale => {
|
||||
controller.logView.setLogLocalisation(loglocale)
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
async loadLogLocaleConfig() {
|
||||
try {
|
||||
const response = await fetch(PUBLIC_URL + "/log_localization");
|
||||
const json = await response.json();
|
||||
const loglocale = json as LogLocalisation;
|
||||
controller.logView.setLogLocalisation(loglocale);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
loadLog() {
|
||||
return fetch(PUBLIC_URL + "/log")
|
||||
.then(response => response.json())
|
||||
.then(json => json as LogArray)
|
||||
.then(logs => {
|
||||
controller.logView.setLog(logs)
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
async loadLog() {
|
||||
try {
|
||||
const response = await fetch(PUBLIC_URL + "/log");
|
||||
const json = await response.json();
|
||||
const logs = json as LogArray;
|
||||
controller.logView.setLog(logs);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async getBackupInfo(): Promise<void> {
|
||||
@@ -241,11 +239,11 @@ export class Controller {
|
||||
return response.status
|
||||
})
|
||||
.then(status => {
|
||||
controller.progressview.removeProgress("set_config");
|
||||
if (status == 200) {
|
||||
controller.progressview.removeProgress("set_config");
|
||||
setTimeout(() => {
|
||||
controller.downloadConfig().then(r => {
|
||||
controller.updateSaveList().then(r => {
|
||||
controller.downloadConfig().then(() => {
|
||||
controller.updateSaveList().then(() => {
|
||||
});
|
||||
});
|
||||
}, 250)
|
||||
@@ -669,7 +667,7 @@ async function executeTasksSequentially() {
|
||||
}
|
||||
}
|
||||
|
||||
executeTasksSequentially().then(r => {
|
||||
executeTasksSequentially().then(() => {
|
||||
controller.progressview.removeProgress("initial")
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user