From 6ee556917c82cf7c33e0940e58d85d79330750c5 Mon Sep 17 00:00:00 2001 From: jazzgrewal Date: Thu, 23 May 2024 11:29:53 -0700 Subject: [PATCH] reusing the VITE_BACKEND_URL for the api calls --- frontend/Caddyfile | 2 +- frontend/openshift.deploy.yml | 2 -- frontend/src/services/OpeningService.js | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/Caddyfile b/frontend/Caddyfile index 9f586d99..d4056fbe 100644 --- a/frontend/Caddyfile +++ b/frontend/Caddyfile @@ -28,7 +28,7 @@ } handle /env.js { header Content-Type "text/javascript" - respond `window.config = {"VITE_USER_POOLS_WEB_CLIENT_ID":"{$VITE_USER_POOLS_WEB_CLIENT_ID}","VITE_ZONE":"{$VITE_ZONE}","VITE_BACKEND_URL":"{$VITE_BACKEND_URL}","BACKEND_URL":"{$BACKEND_URL}"};` + respond `window.config = {"VITE_USER_POOLS_WEB_CLIENT_ID":"{$VITE_USER_POOLS_WEB_CLIENT_ID}","VITE_ZONE":"{$VITE_ZONE}","VITE_BACKEND_URL":"{$VITE_BACKEND_URL}"};` } handle_path /* { diff --git a/frontend/openshift.deploy.yml b/frontend/openshift.deploy.yml index 12268add..5b7ec6d5 100644 --- a/frontend/openshift.deploy.yml +++ b/frontend/openshift.deploy.yml @@ -96,8 +96,6 @@ objects: imagePullPolicy: Always name: ${NAME} env: - - name: BACKEND_URL - value: "https://${NAME}-${ZONE}-backend.${DOMAIN}" - name: LOG_LEVEL value: "${LOG_LEVEL}" - name: VITE_BACKEND_URL diff --git a/frontend/src/services/OpeningService.js b/frontend/src/services/OpeningService.js index 1df7e854..9e4b8568 100644 --- a/frontend/src/services/OpeningService.js +++ b/frontend/src/services/OpeningService.js @@ -1,7 +1,8 @@ import axios from 'axios'; import { getAuthIdToken } from './AuthService'; +import { env } from '../env'; -const backendUrl = process.env.BACKEND_URL; +const backendUrl = env.VITE_BACKEND_URL; export async function fetchRecentOpenings() { let authToken = getAuthIdToken();