diff --git a/.github/workflows/build-deploy-frontend.yml b/.github/workflows/build-deploy-frontend.yml index e36a2ca7..6d17e2b9 100644 --- a/.github/workflows/build-deploy-frontend.yml +++ b/.github/workflows/build-deploy-frontend.yml @@ -26,7 +26,7 @@ jobs: - uses: ./.github/actions/build-frontend name: Build frontend with: - api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net/ + api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net frontend-tarball: ./frontend.tgz frontend-path: ./frontend frontend-build-path: ./frontend/dist/ diff --git a/frontend/api/api.ts b/frontend/api/api.ts index f99dfaac..b0978eee 100644 --- a/frontend/api/api.ts +++ b/frontend/api/api.ts @@ -6,7 +6,7 @@ import { } from "./types/types"; const apiUrl = import.meta.env.VITE_API_URL || "http://localhost:8000/"; -const middlewareURL = import.meta.env.VITE_MIDDLEWARE_API_URL || "http://localhost:8000/"; +export const middlewareURL = import.meta.env.VITE_MIDDLEWARE_API_URL || "http://localhost:8000"; export const AlignImage = async ( args: AlignImageArgs, @@ -44,7 +44,7 @@ export const ImageToText = async ( labels: JSON.stringify(fieldNames), }); - const imageToTextURL = `${middlewareURL}api/image_file_to_text`; + const imageToTextURL = `${middlewareURL}/api/image_file_to_text`; try { const response = await fetch(imageToTextURL, { method: "POST", diff --git a/frontend/src/types/templates.ts b/frontend/src/types/templates.ts index d331a394..e0f29400 100644 --- a/frontend/src/types/templates.ts +++ b/frontend/src/types/templates.ts @@ -1,6 +1,7 @@ import { Organization, Page, User } from "./models.ts"; import { create } from "zustand"; import { Shape } from "react-image-label"; +import {middlewareURL} from "../../api/api.ts"; export interface Template { id: string; @@ -19,11 +20,9 @@ export interface Template { type TemplateStatus = "Completed" | "In Progress" | "Deprecated"; -const MIDDLEWARE_URL = - import.meta.env.VITE_MIDDLEWARE_API_URL || "http://localhost:8081"; export const TemplateAPI = { getTemplates: async (): Promise => { - const response = await fetch(`${MIDDLEWARE_URL}/templates`); + const response = await fetch(`${middlewareURL}/templates`); if (!response.ok) { throw new Error("Unable to fetch templates"); }