Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .workflows/.build/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ services:
context: ../..
dockerfile: .workflows/.build/packages/website/Dockerfile
args:
- VITE_PUBLIC_WEBSITE_URL=${VITE_PUBLIC_WEBSITE_URL:-}
- VITE_PUBLIC_API_URL=${VITE_PUBLIC_API_URL:-}
- VITE_WEBSITE_BASE_URL=${VITE_WEBSITE_BASE_URL:-}
- VITE_API_BASE_URL=${VITE_API_BASE_URL:-}
8 changes: 4 additions & 4 deletions .workflows/.build/packages/website/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ FROM node:25-alpine AS base
RUN npm install -g pnpm@10.26.1

# Define build arguments for environment variables
ARG VITE_PUBLIC_WEBSITE_URL
ARG VITE_PUBLIC_API_URL
ARG VITE_API_BASE_URL
ARG VITE_WEBSITE_BASE_URL

# Set environment variables during the build process
ENV VITE_PUBLIC_WEBSITE_URL=$VITE_PUBLIC_WEBSITE_URL
ENV VITE_PUBLIC_API_URL=$VITE_PUBLIC_API_URL
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
ENV VITE_WEBSITE_BASE_URL=$VITE_WEBSITE_BASE_URL
ENV NODE_OPTIONS="--max-old-space-size=4096"

# Build the repo
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
32 changes: 22 additions & 10 deletions packages/website/src/utilities/getResponseBodyFromAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ export async function getResponseBodyFromAPI<
const abortController = parameters.signal ? undefined : new AbortController()
const signal = parameters.signal ?? abortController!.signal
try {
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL
if (!apiBaseUrl) {
console.error(
"VITE_API_BASE_URL is not defined. The request will not be sent. " +
"Make sure the environment variable is set at build time.",
)
return <const>{
ok: false,
data: undefined,
error: new ClientError({
message: "VITE_API_BASE_URL is not defined",
}),
}
}

const headers: Record<string, string> = {
"Content-Type": "application/json",
}
Expand All @@ -29,16 +44,13 @@ export async function getResponseBodyFromAPI<
headers["X-Organization-Id"] = idOrganization
}

const response = await fetch(
new URL(`${import.meta.env.VITE_API_BASE_URL}${parameters.routeDefinition.path}`),
{
method: "POST",
headers,
credentials: "include",
body: JSON.stringify(parameters.body),
signal,
},
)
const response = await fetch(new URL(`${apiBaseUrl}${parameters.routeDefinition.path}`), {
method: "POST",
headers,
credentials: "include",
body: JSON.stringify(parameters.body),
signal,
})
const jsonResponse = JSON.parse((await response.text()) || "{}")
if (response.ok === false) {
throw new ClientError({
Expand Down
Loading