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
|
COPY ./client /client
|
||||||
WORKDIR /client
|
WORKDIR /client
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
|
RUN echo "VITE_APIURL=/api/v1" > .env.production
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM python:3.11-alpine as runner
|
FROM python:3.11-alpine as runner
|
||||||
|
|||||||
@@ -43,12 +43,24 @@ function App() {
|
|||||||
getLocale: () => i18n.language,
|
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 (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<RefineKbarProvider>
|
<RefineKbarProvider>
|
||||||
<ColorModeContextProvider>
|
<ColorModeContextProvider>
|
||||||
<Refine
|
<Refine
|
||||||
dataProvider={dataProvider("/api/v1")}
|
dataProvider={dataProvider(import.meta.env.VITE_APIURL)}
|
||||||
notificationProvider={notificationProvider}
|
notificationProvider={notificationProvider}
|
||||||
i18nProvider={i18nProvider}
|
i18nProvider={i18nProvider}
|
||||||
routerProvider={routerBindings}
|
routerProvider={routerBindings}
|
||||||
|
|||||||
Reference in New Issue
Block a user