From 615b3583326ddbad803745f6fe868cda90590981 Mon Sep 17 00:00:00 2001 From: coding4kay Date: Wed, 6 Apr 2022 12:21:49 +0200 Subject: [PATCH] fix api endpoints over env --- deployment-sample/mifune-local/docker-compose.yaml | 4 ++-- ui/src/env/Environments.ts | 3 ++- ui/src/helpers/EventSourceHelper.ts | 6 +++--- ui/src/openapi/axios-config.ts | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/deployment-sample/mifune-local/docker-compose.yaml b/deployment-sample/mifune-local/docker-compose.yaml index e96b5516..c1706c2b 100644 --- a/deployment-sample/mifune-local/docker-compose.yaml +++ b/deployment-sample/mifune-local/docker-compose.yaml @@ -18,6 +18,6 @@ services: - "../../server/server/src/test/resources/samples/bom/:/model/:z" environment: QUARKUS_PROFILE: "local" - MIFUNE_ROOT_PATH_API: "http://localhost:8080/api/" - MIFUNE_ROOT_PATH_UI: "http://localhost:8080/ui/" + MIFUNE_ROOT_PATH_API: "http://localhost:8080" + MIFUNE_ROOT_PATH_UI: "http://localhost:8080" QUARKUS_NEO4J_URI: "bolt://neo4j:7687" diff --git a/ui/src/env/Environments.ts b/ui/src/env/Environments.ts index d6f8caa2..45018cfe 100644 --- a/ui/src/env/Environments.ts +++ b/ui/src/env/Environments.ts @@ -1,4 +1,5 @@ export enum ENV { API_SERVER = 'API_SERVER', - BASE_PATH = 'BASE_PATH', + ROOT_URL = 'ROOT_URL', + LOGIN_REQUIRED = 'LOGIN_REQUIRED', } diff --git a/ui/src/helpers/EventSourceHelper.ts b/ui/src/helpers/EventSourceHelper.ts index a334ba56..e7c916cf 100644 --- a/ui/src/helpers/EventSourceHelper.ts +++ b/ui/src/helpers/EventSourceHelper.ts @@ -14,7 +14,7 @@ const header = (): Record => { export const cleanDatabase = (): EventSourcePolyfill => { return new EventSourcePolyfill( - `${localStorage.getItem(ENV.API_SERVER)}apocalypse`, + `${localStorage.getItem(ENV.API_SERVER)}/api/apocalypse`, { headers: header(), heartbeatTimeout: 2000, @@ -24,7 +24,7 @@ export const cleanDatabase = (): EventSourcePolyfill => { export const importSource = (): EventSourcePolyfill => { return new EventSourcePolyfill( - `${localStorage.getItem(ENV.API_SERVER)}graph/domain/fn/statistics`, + `${localStorage.getItem(ENV.API_SERVER)}/api/graph/domain/fn/statistics`, { headers: header(), heartbeatTimeout: 15000, @@ -34,7 +34,7 @@ export const importSource = (): EventSourcePolyfill => { export const graphStats = (): EventSourcePolyfill => { return new EventSourcePolyfill( - `${localStorage.getItem(ENV.API_SERVER)}graph/stats`, + `${localStorage.getItem(ENV.API_SERVER)}/api/graph/stats`, { headers: header(), heartbeatTimeout: 2000, diff --git a/ui/src/openapi/axios-config.ts b/ui/src/openapi/axios-config.ts index 2eceb6b2..72a5fb4c 100644 --- a/ui/src/openapi/axios-config.ts +++ b/ui/src/openapi/axios-config.ts @@ -3,7 +3,7 @@ import { ENV } from '../env/Environments' import { Configuration } from '../services' const AXIOS_CONFIG = (): Configuration => { - const basePath = 'http://localhost:8080' + const basePath = localStorage.getItem(ENV.API_SERVER) ?? undefined const apiKey = undefined const username = undefined const password = undefined