Skip to content

Commit

Permalink
remove extra slash in middleware endpoint and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
zdeveloper committed Dec 13, 2024
1 parent 9c7752c commit 491d562
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
4 changes: 2 additions & 2 deletions frontend/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/types/templates.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<Template[]> => {
const response = await fetch(`${MIDDLEWARE_URL}/templates`);
const response = await fetch(`${middlewareURL}/templates`);
if (!response.ok) {
throw new Error("Unable to fetch templates");
}
Expand Down

0 comments on commit 491d562

Please sign in to comment.