mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
fix(autopause): decouple auto-pause toggle from idle-timeout save [#81 review]
The checkbox @change was wired to saveIdleTimeout, which POSTed BOTH idleTimeoutMinutes and autoPauseOnEmpty: toggling silently committed an unsaved idle edit, and an empty/ non-numeric idle field made the combined POST 400 (errors swallowed), leaving the checkbox flipped but not persisted. Give the toggle its own saveAutoPause() sending only the boolean; 保存 now sends only idleTimeoutMinutes.
This commit is contained in:
1 parent
c57cd35f09
commit
bbdd4cbc78
1 file changed
+8
-5
@@ -442,7 +442,7 @@
|
||||
v-model="autoPauseOnEmpty"
|
||||
type="checkbox"
|
||||
class="profile-toggle-switch"
|
||||
@change="saveIdleTimeout"
|
||||
@change="saveAutoPause"
|
||||
/>
|
||||
</label>
|
||||
</section>
|
||||
@@ -909,10 +909,13 @@ async function loadIdleTimeout() {
|
||||
|
||||
async function saveIdleTimeout() {
|
||||
try {
|
||||
await axios.post('/api/bot/settings', {
|
||||
idleTimeoutMinutes: idleTimeout.value,
|
||||
autoPauseOnEmpty: autoPauseOnEmpty.value,
|
||||
});
|
||||
await axios.post('/api/bot/settings', { idleTimeoutMinutes: idleTimeout.value });
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
async function saveAutoPause() {
|
||||
try {
|
||||
await axios.post('/api/bot/settings', { autoPauseOnEmpty: autoPauseOnEmpty.value });
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user