Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove extra slash in middleware endpoint and clean up #486

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading