Skip to content

Commit 9123ae7

Browse files
committed
chore: fixed issue with end point that broke when switching to react name
1 parent 695fcf7 commit 9123ae7

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/__tests__/pages/api/__tests__/[version]/icons/[iconName].test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function createFetchMock(): typeof fetch {
2828
json: () => Promise.resolve(mockIconsIndex),
2929
} as Response)
3030
}
31-
const match = url.match(/\/api\/[^/]+\/icons\/([^/]+)\.json/)
31+
const match = url.match(/\/api\/[^/]+\/icons\/([^/]+)$/)
3232
if (match) {
3333
const setId = match[1]
3434
const svgs = mockIconSvgs[setId] ?? {}

src/utils/apiIndex/generate.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ export async function generateApiIndex(): Promise<ApiIndex> {
213213

214214
// Convert sets to sorted arrays
215215
// Sections are now always flat strings (subsections are in page names)
216-
index.sections[version] = Array.from(sections).sort()
216+
// Add hardcoded API endpoints (icons, tokens) to the sections list
217+
const allSections = new Set([...sections, 'icons', 'tokens'])
218+
index.sections[version] = Array.from(allSections).sort()
217219

218220
Object.entries(sectionPages).forEach(([key, pages]) => {
219221
index.pages[key] = Array.from(pages).sort()

src/utils/icons/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function fetchIconSvgs(
4242
setId: string,
4343
assetsFetch?: (input: Request) => Promise<Response>,
4444
): Promise<Record<string, string> | null> {
45-
const iconsSvgsUrl = new URL(`/api/${version}/icons/${setId}.json`, url.origin)
45+
const iconsSvgsUrl = new URL(`/api/${version}/icons/${setId}`, url.origin)
4646
const response = assetsFetch
4747
? await assetsFetch(new Request(iconsSvgsUrl))
4848
: await fetch(iconsSvgsUrl)

0 commit comments

Comments
 (0)