ui: fix apply settings (#1045)

This commit is contained in:
ReenigneArcher
2023-03-16 11:27:48 -04:00
committed by GitHub
parent d85b234f1b
commit 7e9b18458d

View File

@@ -475,7 +475,7 @@
</div> </div>
</div> </div>
<!--Output Name --> <!--Output Name -->
<div class="mb-3" class="config-page" v-if="platform === 'windows'"> <div class="mb-3 config-page" v-if="platform === 'windows'">
<label for="output_name" class="form-label">Output Name</label> <label for="output_name" class="form-label">Output Name</label>
<input <input
type="text" type="text"
@@ -502,7 +502,7 @@
Disable if you encounter any VSync-related issues. Disable if you encounter any VSync-related issues.
</div> </div>
</div> </div>
<div class="mb-3" class="config-page" v-if="platform === 'linux'"> <div class="mb-3 config-page" v-if="platform === 'linux'">
<label for="output_name" class="form-label">Monitor number</label> <label for="output_name" class="form-label">Monitor number</label>
<input <input
type="text" type="text"
@@ -1059,7 +1059,8 @@
this.config.fps = JSON.stringify(this.fps).replace(/"/g, ""); this.config.fps = JSON.stringify(this.fps).replace(/"/g, "");
}, },
save() { save() {
this.saved = this.restarted = false; this.saved = false;
this.restarted = false;
this.serialize(); this.serialize();
// create a temp copy of this.config to use for the post request // create a temp copy of this.config to use for the post request
@@ -1089,23 +1090,32 @@
} }
} }
fetch("/api/config", { return fetch("/api/config", {
method: "POST", method: "POST",
body: JSON.stringify(config), body: JSON.stringify(config),
}).then((r) => { }).then((r) => {
if (r.status === 200) this.saved = true; if (r.status === 200) {
this.saved = true
return this.saved
}
else {
return false
}
}); });
}, },
apply() { apply() {
this.saved = this.restarted = false; this.saved = this.restarted = false;
this.save(); let saved = this.save();
if (this.saved === true) {
fetch("/api/restart", { saved.then((result) => {
method: "POST", if (result === true) {
}).then((r) => { fetch("/api/restart", {
if (r.status === 200) this.restarted = true; method: "POST"
}); }).then((r) => {
} if (r.status === 200) this.restarted = true;
});
}
});
}, },
}, },
}); });