Footer enhancements and performance optimizations #9

Merged
deco merged 10 commits from footer-enhancements into main 2025-07-22 23:01:23 +03:00
5 changed files with 7 additions and 17 deletions
Showing only changes of commit 8c2de2c66b - Show all commits

View file

@ -65,8 +65,7 @@ export default function EditStream() {
team_id: streamData.team_id, team_id: streamData.team_id,
}); });
// Handle both old and new API response formats const teams = teamsData.data;
const teams = teamsData.success ? teamsData.data : teamsData;
// Map teams for dropdown // Map teams for dropdown
setTeams( setTeams(

View file

@ -80,12 +80,8 @@ export default function Home() {
activeRes.json() activeRes.json()
]); ]);
// Handle both old and new API response formats setStreams(streamsData.data);
const streams = streamsData.success ? streamsData.data : streamsData; setActiveSources(activeData);
const activeSources = activeData.success ? activeData.data : activeData;
setStreams(streams);
setActiveSources(activeSources);
} catch (error) { } catch (error) {
console.error('Error fetching data:', error); console.error('Error fetching data:', error);
showError('Failed to Load Data', 'Could not fetch streams. Please refresh the page.'); showError('Failed to Load Data', 'Could not fetch streams. Please refresh the page.');

View file

@ -40,9 +40,8 @@ export default function AddStream() {
const teamsData = await teamsResponse.json(); const teamsData = await teamsResponse.json();
const streamsData = await streamsResponse.json(); const streamsData = await streamsResponse.json();
// Handle both old and new API response formats const teams = teamsData.data;
const teams = teamsData.success ? teamsData.data : teamsData; const streams = streamsData.data;
const streams = streamsData.success ? streamsData.data : streamsData;
// Map the API data to the format required by the Dropdown // Map the API data to the format required by the Dropdown
setTeams( setTeams(

View file

@ -41,9 +41,7 @@ export default function Teams() {
try { try {
const res = await fetch('/api/teams'); const res = await fetch('/api/teams');
const data = await res.json(); const data = await res.json();
// Handle both old and new API response formats setTeams(data.data);
const teams = data.success ? data.data : data;
setTeams(teams);
} catch (error) { } catch (error) {
console.error('Error fetching teams:', error); console.error('Error fetching teams:', error);
} finally { } finally {

View file

@ -50,9 +50,7 @@ export default function Footer() {
try { try {
const response = await fetch('/api/counts'); const response = await fetch('/api/counts');
const data = await response.json(); const data = await response.json();
// Handle both old and new API response formats setCounts(data.data);
const countsData = data.success ? data.data : data;
setCounts(countsData);
} catch (error) { } catch (error) {
console.error('Failed to fetch counts:', error); console.error('Failed to fetch counts:', error);
} }