Fix frontend API paths to include /api/v1 prefix
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ export default function MembersSection({ teamId }) {
|
||||
|
||||
const loadRoles = useCallback(async () => {
|
||||
try {
|
||||
const resp = await sw.api.get(`/teams/${teamId}/roles`);
|
||||
const resp = await sw.api.get(`/api/v1/teams/${teamId}/roles`);
|
||||
setRoles(resp.data || ['admin', 'member']);
|
||||
} catch { setRoles(['admin', 'member']); }
|
||||
}, [teamId]);
|
||||
@@ -137,7 +137,7 @@ export default function MembersSection({ teamId }) {
|
||||
if (!newRole.trim()) return;
|
||||
const updated = [...new Set([...roles, newRole.trim()])];
|
||||
try {
|
||||
await sw.api.put('/teams/' + teamId + '/roles', { roles: updated });
|
||||
await sw.api.put('/api/v1/teams/' + teamId + '/roles', { roles: updated });
|
||||
setRoles(updated);
|
||||
setNewRole('');
|
||||
sw.toast('Role added', 'success');
|
||||
@@ -151,7 +151,7 @@ export default function MembersSection({ teamId }) {
|
||||
<button class="btn-small btn-danger" onClick=${async () => {
|
||||
const updated = roles.filter(x => x !== r);
|
||||
try {
|
||||
await sw.api.put('/teams/' + teamId + '/roles', { roles: updated });
|
||||
await sw.api.put('/api/v1/teams/' + teamId + '/roles', { roles: updated });
|
||||
setRoles(updated);
|
||||
sw.toast('Role removed', 'success');
|
||||
load(); // re-check members
|
||||
|
||||
@@ -298,7 +298,7 @@ function StageForm({ stage, teams, onSave, onCancel }) {
|
||||
|
||||
useEffect(() => {
|
||||
if (!assignTeam) return;
|
||||
sw.api.get(`/teams/${assignTeam}/roles`).then(r => setTeamRoles(r.data || ['admin', 'member'])).catch(() => {});
|
||||
sw.api.get(`/api/v1/teams/${assignTeam}/roles`).then(r => setTeamRoles(r.data || ['admin', 'member'])).catch(() => {});
|
||||
}, [assignTeam]);
|
||||
|
||||
function submit() {
|
||||
@@ -583,7 +583,7 @@ function SignoffPanel({ instanceId, teamId }) {
|
||||
|
||||
const load = useCallback(async () => {
|
||||
try {
|
||||
const resp = await sw.api.get(`/instances/${instanceId}/signoffs`);
|
||||
const resp = await sw.api.get(`/api/v1/instances/${instanceId}/signoffs`);
|
||||
setSignoffs(resp.data || []);
|
||||
} catch { setSignoffs([]); }
|
||||
finally { setLoading(false); }
|
||||
@@ -593,7 +593,7 @@ function SignoffPanel({ instanceId, teamId }) {
|
||||
|
||||
async function submit(decision) {
|
||||
try {
|
||||
await sw.api.post(`/instances/${instanceId}/signoffs`, { decision, comment });
|
||||
await sw.api.post(`/api/v1/instances/${instanceId}/signoffs`, { decision, comment });
|
||||
sw.toast(decision === 'approve' ? 'Approved' : 'Rejected', 'success');
|
||||
setComment('');
|
||||
load();
|
||||
|
||||
Reference in New Issue
Block a user