Skip to content

Commit

Permalink
fix: .env fixes for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtrazy committed Jul 18, 2024
1 parent 1ebd25b commit 509a791
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/User/AllFoodItems/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ function index() {

const fetchItems = async () => {
try {
const response = await fetch('http://localhost:8080/api/lafresca/food');
let apiUrl = (import.meta as any).env.VITE_API_URL;
const response = await fetch(`${apiUrl}/food`);
if (!response.ok) {
throw new Error('Failed to fetch item');
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/User/FoodItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ function index({ id }: Props) {

const fetchItems = async () => {
try {
let apiUrl = (import.meta as any).env.VITE_API_URL;
const response = await fetch(
`http://localhost:8080/api/lafresca/food/${id}`,
`${apiUrl}/food/${id}`,
);
if (!response.ok) {
throw new Error('Failed to fetch item');
Expand Down

0 comments on commit 509a791

Please sign in to comment.