default client to same-origin /api/v1 and window.location.origin, drop UPTIME_APP_* placeholders
This commit is contained in:
1 parent
f7d3bcb696
commit
6d91efecad
4 files changed
+10
-7
No files matched your search
@@ -1,4 +1,6 @@
|
|||||||
VITE_APP_API_BASE_URL=UPTIME_APP_API_BASE_URL
|
# Production builds use same-origin defaults: API at /api/v1, client host from
|
||||||
VITE_APP_API_V2_BASE_URL=UPTIME_APP_API_V2_BASE_URL
|
# window.location.origin. The empty values below override any local .env so a
|
||||||
VITE_APP_CLIENT_HOST=UPTIME_APP_CLIENT_HOST
|
# production build never bakes in a developer's localhost URLs.
|
||||||
VITE_APP_LOG_LEVEL=UPTIME_APP_LOG_LEVEL
|
VITE_APP_API_BASE_URL=
|
||||||
|
VITE_APP_CLIENT_HOST=
|
||||||
|
VITE_APP_LOG_LEVEL=
|
||||||
@@ -56,7 +56,7 @@ export const InviteTeamMemberDialog = ({
|
|||||||
const result = await generateToken("/invite", data);
|
const result = await generateToken("/invite", data);
|
||||||
if (result?.data?.token) {
|
if (result?.data?.token) {
|
||||||
const token = result.data.token;
|
const token = result.data.token;
|
||||||
const link = CLIENT_HOST ? `${CLIENT_HOST}/register/${token}` : token;
|
const link = `${CLIENT_HOST || window.location.origin}/register/${token}`;
|
||||||
setInviteLink(link);
|
setInviteLink(link);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Vendored
+2
-1
@@ -3,7 +3,8 @@
|
|||||||
declare const __APP_VERSION__: string;
|
declare const __APP_VERSION__: string;
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_APP_API_V2_BASE_URL?: string;
|
readonly VITE_APP_API_BASE_URL?: string;
|
||||||
|
readonly VITE_APP_CLIENT_HOST?: string;
|
||||||
readonly VITE_APP_LOG_LEVEL?: "debug" | "info" | "warn" | "error";
|
readonly VITE_APP_LOG_LEVEL?: "debug" | "info" | "warn" | "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import axios from "axios";
|
|||||||
import type { AxiosError } from "axios";
|
import type { AxiosError } from "axios";
|
||||||
import type { AxiosRequestConfig, AxiosResponse } from "axios";
|
import type { AxiosRequestConfig, AxiosResponse } from "axios";
|
||||||
|
|
||||||
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL || "/api/v1";
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: BASE_URL,
|
baseURL: BASE_URL,
|
||||||
|
|||||||
Reference in new issue
Block a user