From 2a9d7cefec63bb4cf3244713cfa06a9b9fdab2dc Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 31 Mar 2023 12:02:25 +0200 Subject: [PATCH] fix(ui): use public healthstatus route --- frontend/app/components/Header/HealthStatus/getHealth.ts | 4 ++-- frontend/app/components/Signup/Signup.js | 2 +- frontend/app/services/HealthService.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/app/components/Header/HealthStatus/getHealth.ts b/frontend/app/components/Header/HealthStatus/getHealth.ts index 70bd8914c..c378b0e8f 100644 --- a/frontend/app/components/Header/HealthStatus/getHealth.ts +++ b/frontend/app/components/Header/HealthStatus/getHealth.ts @@ -26,8 +26,8 @@ function mapResponse(resp: Record) { return { overallHealth, healthMap }; } -export async function getHealthRequest() { - const r = await healthService.fetchStatus(); +export async function getHealthRequest(isPublic?: boolean) { + const r = await healthService.fetchStatus(isPublic); const healthMap = mapResponse(r); const asked = new Date().getTime(); localStorage.setItem(healthResponseKey, JSON.stringify(healthMap)); diff --git a/frontend/app/components/Signup/Signup.js b/frontend/app/components/Signup/Signup.js index fc2dfcec4..c6b02f88a 100644 --- a/frontend/app/components/Signup/Signup.js +++ b/frontend/app/components/Signup/Signup.js @@ -54,7 +54,7 @@ export default class Signup extends React.Component { getHealth = async () => { this.setState({ healthStatusLoading: true }); - const { healthMap } = await getHealthRequest(); + const { healthMap } = await getHealthRequest(true); this.setState({ healthStatus: healthMap, healthStatusLoading: false }); } diff --git a/frontend/app/services/HealthService.ts b/frontend/app/services/HealthService.ts index 7d2b3cc7f..bc6815a2c 100644 --- a/frontend/app/services/HealthService.ts +++ b/frontend/app/services/HealthService.ts @@ -1,8 +1,8 @@ import BaseService from './BaseService'; export default class HealthService extends BaseService { - fetchStatus(): Promise { - return this.client.get('/health') + fetchStatus(isPublic?: boolean): Promise { + return this.client.get(isPublic ? '/health' : '/healthz') .then(r => r.json()) .then(j => j.data || {}) }