refactor: optimizations & fixes

This commit is contained in:
Yurii
2024-11-11 15:45:36 +03:00
parent 24a46f4c16
commit c6df74f06e
9 changed files with 244 additions and 205 deletions

View File

@@ -306,22 +306,6 @@ const setupRestoreBackupForm = (formSelector) => {
try {
const data = JSON.parse(event.target.result);
console.log("Backup: ", data);
if (data.network != undefined) {
let response = await fetch(url, {
method: 'POST',
cache: 'no-cache',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({"network": data.network})
});
if (!response.ok) {
onFailed();
return;
}
}
if (data.settings != undefined) {
let response = await fetch(url, {
@@ -362,6 +346,22 @@ const setupRestoreBackupForm = (formSelector) => {
}
}
if (data.network != undefined) {
let response = await fetch(url, {
method: 'POST',
cache: 'no-cache',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({"network": data.network})
});
if (!response.ok) {
onFailed();
return;
}
}
onSuccess();
} catch (err) {