fix(api): align API layer with backend response formats
- wallet: parse {balance: string} response
- favorites: addFavorite returns void (EmptyResp)
- services: handle paginated response from listServicesByPlayer
- files: use query param ?key= instead of path param /:id
- search: remove unsupported selectedGames/minRating params
This commit is contained in:
+10
-3
@@ -37,7 +37,14 @@ export async function getServiceById(serviceId: string): Promise<PlayerService |
|
||||
}
|
||||
|
||||
export async function listServicesByPlayer(playerId: string): Promise<PlayerService[]> {
|
||||
return httpJson<PlayerService[]>(`/api/v1/players/${encodeURIComponent(playerId)}/services`, {
|
||||
cache: "no-store",
|
||||
})
|
||||
const res = await httpJson<Paginated<PlayerService> | PlayerService[]>(
|
||||
`/api/v1/players/${encodeURIComponent(playerId)}/services`,
|
||||
{
|
||||
cache: "no-store",
|
||||
},
|
||||
)
|
||||
if (typeof res === "object" && res !== null && "items" in res) {
|
||||
return (res as Paginated<PlayerService>).items
|
||||
}
|
||||
return res as PlayerService[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user