Skip to content

Commit

Permalink
fix(server): refactoring get game details to use arcade id
Browse files Browse the repository at this point in the history
  • Loading branch information
rallieon committed Sep 13, 2021
1 parent e4e2c52 commit f447081
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/server/src/api/haste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ export class Haste {
return response.data;
}

private static async getGameDetails(accessToken: string, url: string, gameId: string): Promise<Game> {
const path = `/developergames/${gameId}`;
private static async getGameDetails(
accessToken: string,
url: string,
arcadeId: string,
gameId: string,
): Promise<Game> {
const path = `arcades/${arcadeId}/developergames/${gameId}`;

const response = await axios.get<Game>(`${url}${path}`, {
headers: { Authorization: `Bearer ${accessToken}` },
Expand Down Expand Up @@ -79,7 +84,12 @@ export class Haste {
configuration.gameId = tokenResponse.gameId;
configuration.accessToken = tokenResponse.access_token;

const gameDetails = await Haste.getGameDetails(configuration.accessToken, url, configuration.gameId);
const gameDetails = await Haste.getGameDetails(
configuration.accessToken,
url,
configuration.arcadeId,
configuration.gameId,
);

return new Haste(configuration, gameDetails);
}
Expand Down

0 comments on commit f447081

Please sign in to comment.