diff --git a/client/src/lib/api.ts b/client/src/lib/api.ts index 879908f..55ba784 100644 --- a/client/src/lib/api.ts +++ b/client/src/lib/api.ts @@ -1,8 +1,9 @@ import { Api } from "../__generated__/api" import { jwtDecode } from 'jwt-decode' -const OAUTH_SERVER = "http://localhost:8000/o" -const CLIENT_ID = '9COYxKq9FZVr2WFtFqtkkpM8mdS8Qe23D1ohVNn1' +const OAUTH_SERVER = import.meta.env.VITE_OAUTH_SERVER +const CLIENT_ID = import.meta.env.VITE_CLIENT_ID +const API_BASE = import.meta.env.VITE_API_BASE const SCOPES = ['openid', 'user/basic', 'media'] const urlParams = new URLSearchParams(window.location.search) @@ -35,7 +36,7 @@ if (!token || (decoded?.exp||0) * 1000 < Date.now()) { } export default new Api({ - baseUrl: "http://localhost:7000", + baseUrl: API_BASE, baseApiParams: { credentials: "same-origin", headers: { diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts index 4078e74..f3170fb 100644 --- a/client/src/vite-env.d.ts +++ b/client/src/vite-env.d.ts @@ -1,2 +1,12 @@ /// /// + +interface ImportMetaEnv { + readonly VITE_OAUTH_SERVER: string + readonly VITE_CLIENT_ID: string + readonly VITE_API_BASE: string +} + +interface ImportMeta { + readonly env: ImportMetaEnv +} diff --git a/client/tsconfig.json b/client/tsconfig.json index de15795..ee5e567 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -14,6 +14,7 @@ "allowJs": true, "checkJs": true, "isolatedModules": true, + "baseUrl": ".", "paths": { "$lib/*": ["src/lib/*"], }