Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(self-hosted): platform routes with codegen

Alaister Young6dd74d51cd92
diff --git a/studio/data/fetchers.ts b/studio/data/fetchers.ts
index 6c5ca18facd..22f12bbbfe5 100644
--- a/studio/data/fetchers.ts
+++ b/studio/data/fetchers.ts
@@ -1,4 +1,4 @@
-import { API_URL } from 'lib/constants'
+import { API_URL, IS_PLATFORM } from 'lib/constants'
import { getAccessToken } from 'lib/gotrue'
import { uuidv4 } from 'lib/helpers'
import createClient from 'openapi-fetch'
@@ -44,6 +44,12 @@ export async function constructHeaders(headersInit?: HeadersInit | undefined) {
export const get: typeof _get = async (url, init) => {
const headers = await constructHeaders(init?.headers)
+ // on self-hosted, we don't have a /platform prefix
+ if (!IS_PLATFORM && url.startsWith('/platform')) {
+ // @ts-ignore
+ url = url.replace('/platform', '')
+ }
+
return await _get(url, {
...init,
headers,
@@ -53,6 +59,12 @@ export const get: typeof _get = async (url, init) => {
export const post: typeof _post = async (url, init) => {
const headers = await constructHeaders(init?.headers)
+ // on self-hosted, we don't have a /platform prefix
+ if (!IS_PLATFORM && url.startsWith('/platform')) {
+ // @ts-ignore
+ url = url.replace('/platform', '')
+ }
+
return await _post(url, {
...init,
headers,
@@ -62,6 +74,12 @@ export const post: typeof _post = async (url, init) => {
export const put: typeof _put = async (url, init) => {
const headers = await constructHeaders(init?.headers)
+ // on self-hosted, we don't have a /platform prefix
+ if (!IS_PLATFORM && url.startsWith('/platform')) {
+ // @ts-ignore
+ url = url.replace('/platform', '')
+ }
+
return await _put(url, {
...init,
headers,
@@ -71,6 +89,12 @@ export const put: typeof _put = async (url, init) => {
export const patch: typeof _patch = async (url, init) => {
const headers = await constructHeaders(init?.headers)
+ // on self-hosted, we don't have a /platform prefix
+ if (!IS_PLATFORM && url.startsWith('/platform')) {
+ // @ts-ignore
+ url = url.replace('/platform', '')
+ }
+
return await _patch(url, {
...init,
headers,
@@ -80,6 +104,12 @@ export const patch: typeof _patch = async (url, init) => {
export const del: typeof _del = async (url, init) => {
const headers = await constructHeaders(init?.headers)
+ // on self-hosted, we don't have a /platform prefix
+ if (!IS_PLATFORM && url.startsWith('/platform')) {
+ // @ts-ignore
+ url = url.replace('/platform', '')
+ }
+
return await _del(url, {
...init,
headers,
@@ -89,6 +119,12 @@ export const del: typeof _del = async (url, init) => {
export const head: typeof _head = async (url, init) => {
const headers = await constructHeaders(init?.headers)
+ // on self-hosted, we don't have a /platform prefix
+ if (!IS_PLATFORM && url.startsWith('/platform')) {
+ // @ts-ignore
+ url = url.replace('/platform', '')
+ }
+
return await _head(url, {
...init,
headers,