Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NBA & WNBA Viewer] Fix #15114 - specify correct season in NBA Viewer standings #15117

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions extensions/nba-game-viewer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# NBA Game Viewer Changelog

## [Fixes] - 2024-10-28

- Removed year from standings to default to current season.

## [Improvements] - 2024-08-28

- Added a score command that shows the scores of the games that are currently in progress and the games from the last 7 days.
Expand Down
1 change: 0 additions & 1 deletion extensions/nba-game-viewer/src/hooks/useStandings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const getConferenceStandings = (conferenceStanding: ConferenceStanding): Team[]

const fetchStandings = async (league: string) => {
const standingsData = await getStandings({
year: new Date().getFullYear().toString(),
league: league,
group: "conference",
});
Expand Down
4 changes: 1 addition & 3 deletions extensions/nba-game-viewer/src/utils/getStandings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import axios from "axios";
import { StandingsResponse } from "../types/standings.types";

type GetStandingsArgs = {
year: string;
league: string; // "nba" or "wnba"
group: string; // "conference" or "league"
};

const getStandings = async ({ year, league, group }: GetStandingsArgs): Promise<StandingsResponse> => {
const getStandings = async ({ league, group }: GetStandingsArgs): Promise<StandingsResponse> => {
const baseUrl = `https://site.web.api.espn.com/apis/v2/sports/basketball/${league}/standings`;

const params = {
region: "us",
lang: "en",
contentorigin: "espn",
season: year,
type: league === "nba" ? 1 : 0, // Type ID differs between leagues
level: group === "league" ? 1 : 2, // Group ID for league vs conference
};
Expand Down