Client: Don't hard code the API endpoint anymore
This commit is contained in:
@@ -3,6 +3,8 @@ FROM node:16-alpine as client-builder
|
||||
COPY ./client /client
|
||||
WORKDIR /client
|
||||
RUN npm install
|
||||
|
||||
RUN echo "VITE_APIURL=/api/v1" > .env.production
|
||||
RUN npm run build
|
||||
|
||||
FROM python:3.11-alpine as runner
|
||||
|
||||
@@ -43,12 +43,24 @@ function App() {
|
||||
getLocale: () => i18n.language,
|
||||
};
|
||||
|
||||
if (!import.meta.env.VITE_APIURL) {
|
||||
return (
|
||||
<>
|
||||
<h1>Missing API URL</h1>
|
||||
<p>
|
||||
App was built without an API URL. Please set the VITE_APIURL
|
||||
environment variable to the URL of your Spoolman API.
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<RefineKbarProvider>
|
||||
<ColorModeContextProvider>
|
||||
<Refine
|
||||
dataProvider={dataProvider("/api/v1")}
|
||||
dataProvider={dataProvider(import.meta.env.VITE_APIURL)}
|
||||
notificationProvider={notificationProvider}
|
||||
i18nProvider={i18nProvider}
|
||||
routerProvider={routerBindings}
|
||||
|
||||
Reference in New Issue
Block a user