Skip to content

Commit 1cd97fd

Browse files
committed
test: fix tests
1 parent 9fcb831 commit 1cd97fd

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/hooks/useFetchSpeakers.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,29 @@ import { ISpeaker } from "../types/speakers";
66
const URLS = {
77
default: "https://sessionize.com/api/v2/xhudniix/view/Speakers",
88
2023: "https://sessionize.com/api/v2/ttsitynd/view/Speakers",
9-
2024: "https://sessionize.com/api/v2/teq4asez/view/Speakers"
9+
2024: "https://sessionize.com/api/v2/teq4asez/view/Speakers",
1010
};
1111

12-
export const useFetchSpeakers = (yearOrUrl?: string, id?: string): UseQueryResult<ISpeaker[]> => {
12+
export const useFetchSpeakers = (
13+
yearOrUrl?: string,
14+
id?: string,
15+
): UseQueryResult<ISpeaker[]> => {
1316
// Determine if the first parameter is a URL or an ID
1417
let url = URLS.default;
1518
let speakerId = id;
1619

17-
if (urlOrId) {
20+
if (yearOrUrl) {
1821
// If urlOrId starts with http, it's a URL
19-
if (urlOrId.startsWith("http")) {
20-
url = urlOrId;
21-
}
22+
if (yearOrUrl.startsWith("http")) {
23+
url = yearOrUrl;
24+
}
2225
// If urlOrId is a year key in URLS, use that URL
23-
else if (urlOrId in URLS) {
24-
url = URLS[urlOrId as keyof typeof URLS];
25-
}
26+
else if (yearOrUrl in URLS) {
27+
url = URLS[yearOrUrl as keyof typeof URLS];
28+
}
2629
// Otherwise, it's an ID
2730
else {
28-
speakerId = urlOrId;
31+
speakerId = yearOrUrl;
2932
}
3033
}
3134

@@ -42,4 +45,4 @@ export const useFetchSpeakers = (yearOrUrl?: string, id?: string): UseQueryResul
4245

4346
return speakerAdapter(returnData);
4447
});
45-
};
48+
};

0 commit comments

Comments
 (0)