Skip to content

Commit 927ce6b

Browse files
authored
fix: Revert the getProjects query to use the v1 of /platform/projects API endpoint (supabase#38263)
Revert the getProjects query to use the v1 and get all projects.
1 parent ef78a07 commit 927ce6b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

apps/studio/data/projects/projects-query.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ export async function getProjects({
2222
signal?: AbortSignal
2323
headers?: Record<string, string>
2424
}) {
25-
const { data, error } = await get('/platform/projects', {
26-
signal,
27-
headers: { ...headers, Version: '2' },
28-
})
25+
const { data, error } = await get('/platform/projects', { signal, headers })
2926

3027
if (error) handleError(error)
31-
// [Joshen] API TS issue
32-
return data as unknown as PaginatedProjectsResponse
28+
// The /platform/projects endpoint has a v2 which is activated by passing a {version: '2'} header. The v1 API returns
29+
// all projects while the v2 returns paginated list of projects. Wrapping the v1 API response into a
30+
// { projects: ProjectInfo[] } is intentional to be forward compatible with the structure of v2 for easier migration.
31+
return { projects: data }
3332
}
3433

3534
export type ProjectsData = Awaited<ReturnType<typeof getProjects>>

0 commit comments

Comments
 (0)