Skip to content

Commit

Permalink
connect frontend to ocr api in dev env (#272)
Browse files Browse the repository at this point in the history
* connect frontend to ocr api in dev env

* .env files are not working as expected

* adjust github workflow

* refactor
  • Loading branch information
zdeveloper authored Oct 1, 2024
1 parent f5f7371 commit d80e79c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 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 @@ -25,7 +25,7 @@ jobs:
- name: Install NPM packages
run: npm ci
- name: Build project
run: npm run build
run: VITE_API_URL=https://reportvision-ocr-api-dev.azurewebsites.net/ npm run build
- name: Run unit tests
run: npm run test
- name: Create client build archive
Expand Down
5 changes: 3 additions & 2 deletions frontend/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ export const ImageToText = async (args: ImageToTextArgs): Promise<ImageToTextRes
segmentation_template: templateImage,
labels: JSON.stringify(fieldNames),
});


const apiUrl = import.meta.env.VITE_API_URL || "http://localhost:8000/"
try {
const response = await fetch(`${import.meta.env.VITE_API_URL}image_to_text/`, {
const response = await fetch(`${apiUrl}image_to_text/`, {
"method": "POST",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
Expand Down

0 comments on commit d80e79c

Please sign in to comment.