Fix frontend compatibility with new API response format
Frontend Updates: - Handle both old and new API response formats for backward compatibility - Updated Teams, Streams, and Edit Stream pages to parse new response structure - Added graceful handling of { success: true, data: [...] } format - Maintained support for legacy direct array responses Bug Fix: - Resolved TypeError: teamsData.map is not a function - Ensures smooth transition as we update API endpoints - Prevents breaking changes during API modernization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f4df3df698
commit
a66979fb34
3 changed files with 13 additions and 4 deletions
|
@ -26,7 +26,9 @@ export default function Teams() {
|
|||
try {
|
||||
const res = await fetch('/api/teams');
|
||||
const data = await res.json();
|
||||
setTeams(data);
|
||||
// Handle both old and new API response formats
|
||||
const teams = data.success ? data.data : data;
|
||||
setTeams(teams);
|
||||
} catch (error) {
|
||||
console.error('Error fetching teams:', error);
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue