Skip to content

Commit

Permalink
Fix for typescript error
Browse files Browse the repository at this point in the history
  • Loading branch information
salty2011 committed Jan 15, 2025
1 parent e7063f3 commit d3c9387
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ app.post('/api/users', async (req, res) => {
});
}

const data = await response.json();
if (!data.response) {
const data = await response.json() as SteamApiResponse;
if (!data.response || !Array.isArray(data.response.games)) {
serverLog('error', 'Invalid response from Steam API', 'Server', { data });
return res.status(400).json({ error: 'Invalid response from Steam API' });
}
Expand Down Expand Up @@ -609,8 +609,8 @@ app.put('/api/users/:username', async (req, res) => {
});
}

const data = await response.json();
if (!data.response) {
const data = await response.json() as SteamApiResponse;
if (!data.response || !Array.isArray(data.response.games)) {
serverLog('error', 'Invalid response from Steam API', 'Server', { data });
return res.status(400).json({ error: 'Invalid response from Steam API' });
}
Expand Down

0 comments on commit d3c9387

Please sign in to comment.