diff --git a/.env.development b/.env.development index 261850c..141e783 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,2 @@ VITE_API_BASE_URL=https://api.dev.kittycad.io VITE_SITE_BASE_URL=https://dev.kittycad.io -BASE_URL=https://api.dev.kittycad.io/ diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 3a2e442..f37b45e 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -9,6 +9,12 @@ export const load = async ({ cookies }) => { } } + // We need to tell the client to use the right base URL + if (import.meta.env.MODE !== 'production') { + // Set the env variable BASE_URL to import.meta.env.VITE_API_BASE_URL. + // This will be used by the client to make requests to the API. + process.env.BASE_URL = import.meta.env.VITE_API_BASE_URL + '/' + } const client = new Client(token) const response = await users.get_user_self({ client })