fix(ui): use public healthstatus route

This commit is contained in:
nick-delirium 2023-03-31 12:02:25 +02:00
parent fffe458a76
commit 2a9d7cefec
3 changed files with 5 additions and 5 deletions

View file

@ -26,8 +26,8 @@ function mapResponse(resp: Record<string, any>) {
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));

View file

@ -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 });
}

View file

@ -1,8 +1,8 @@
import BaseService from './BaseService';
export default class HealthService extends BaseService {
fetchStatus(): Promise<any> {
return this.client.get('/health')
fetchStatus(isPublic?: boolean): Promise<any> {
return this.client.get(isPublic ? '/health' : '/healthz')
.then(r => r.json())
.then(j => j.data || {})
}