mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 16:39:42 +02:00
fix: case selection not persisting across page refresh (#49)
Thank you for the clean fix! The root cause analysis in the PR description was excellent — the strict Zod schema rejecting modelConfig during the GET-then-PUT pattern was a subtle bug.
This commit is contained in:
@@ -109,16 +109,10 @@ Object.assign(CodemanApp.prototype, {
|
|||||||
|
|
||||||
async saveLastUsedCase(caseName) {
|
async saveLastUsedCase(caseName) {
|
||||||
try {
|
try {
|
||||||
// Get current settings
|
|
||||||
const res = await fetch('/api/settings');
|
|
||||||
const settings = res.ok ? await res.json() : {};
|
|
||||||
// Update lastUsedCase
|
|
||||||
settings.lastUsedCase = caseName;
|
|
||||||
// Save back
|
|
||||||
await fetch('/api/settings', {
|
await fetch('/api/settings', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(settings)
|
body: JSON.stringify({ lastUsedCase: caseName })
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to save last used case:', err);
|
console.error('Failed to save last used case:', err);
|
||||||
|
|||||||
Reference in New Issue
Block a user