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:
saopig1 committed 2026-06-16 14:45:01 +08:00
1 parent c57cd35f09
commit bbdd4cbc78
1 file changed
+8 -5
+8 -5
View File
@@ -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 */ }
} }