[eric] state: the last seven data.X thunks reject on non-2xx, closing the ENG-277 payload class

This commit is contained in:
ciregenz
2026-08-12 19:47:27 -07:00
parent 74de4c2da8
commit e2602f96de
4 changed files with 7 additions and 0 deletions
+1
View File
@@ -231,6 +231,7 @@ export const launchAgent = createAsyncThunk('agents/launchAgent', async (config:
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(config),
});
if (!res.ok) throw new Error(`Launch failed: ${res.status}`);
const data = await res.json();
return data.session as AgentSession;
});
+3
View File
@@ -44,6 +44,7 @@ export const createMode = createAsyncThunk(
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`Create mode failed: ${res.status}`);
const data = await res.json();
return data.mode as Mode;
}
@@ -57,6 +58,7 @@ export const updateMode = createAsyncThunk(
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(updates),
});
if (!res.ok) throw new Error(`Update mode failed: ${res.status}`);
const data = await res.json();
return data.mode as Mode;
}
@@ -66,6 +68,7 @@ export const resetMode = createAsyncThunk(
'modes/reset',
async (id: string) => {
const res = await fetch(`${MODES_API}/${id}/reset`, { method: 'POST' });
if (!res.ok) throw new Error(`Reset mode failed: ${res.status}`);
const data = await res.json();
return data.mode as Mode;
}
+2
View File
@@ -51,6 +51,7 @@ export const createSkill = createAsyncThunk(
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`Create skill failed: ${res.status}`);
const data = await res.json();
return data.skill as Skill;
}
@@ -64,6 +65,7 @@ export const updateSkill = createAsyncThunk(
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(updates),
});
if (!res.ok) throw new Error(`Update skill failed: ${res.status}`);
const data = await res.json();
return data.skill as Skill;
}
+1
View File
@@ -66,6 +66,7 @@ export const createTool = createAsyncThunk(
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`Create tool failed: ${res.status}`);
const data = await res.json();
return data.tool as ToolDefinition;
}