mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-01 20:42: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"
|
v-model="autoPauseOnEmpty"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="profile-toggle-switch"
|
class="profile-toggle-switch"
|
||||||
@change="saveIdleTimeout"
|
@change="saveAutoPause"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
</section>
|
</section>
|
||||||
@@ -909,10 +909,13 @@ async function loadIdleTimeout() {
|
|||||||
|
|
||||||
async function saveIdleTimeout() {
|
async function saveIdleTimeout() {
|
||||||
try {
|
try {
|
||||||
await axios.post('/api/bot/settings', {
|
await axios.post('/api/bot/settings', { idleTimeoutMinutes: idleTimeout.value });
|
||||||
idleTimeoutMinutes: idleTimeout.value,
|
} catch { /* ignore */ }
|
||||||
autoPauseOnEmpty: autoPauseOnEmpty.value,
|
}
|
||||||
});
|
|
||||||
|
async function saveAutoPause() {
|
||||||
|
try {
|
||||||
|
await axios.post('/api/bot/settings', { autoPauseOnEmpty: autoPauseOnEmpty.value });
|
||||||
} catch { /* ignore */ }
|
} catch { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user