fix: usar env para API HOST

This commit is contained in:
Cat /dev/Nulo 2024-08-04 13:03:52 -03:00
parent 8d9fce5293
commit 4bf1351688
5 changed files with 8 additions and 3 deletions

2
.gitignore vendored
View file

@ -3,7 +3,7 @@ node_modules/
*.db-shm
*.db-wal
target/
.env.*
*.local
.DS_Store

View file

@ -0,0 +1 @@
DB_PATH=../sqlite.db

2
sitio/.env.development Normal file
View file

@ -0,0 +1,2 @@
DB_PATH=../sqlite.db
VITE_API_HOST=http://localhost:8000

2
sitio/.gitignore vendored
View file

@ -4,7 +4,7 @@ node_modules
/.svelte-kit
/package
.env
.env.*
*.local
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

View file

@ -2,7 +2,9 @@ import type { PageServerLoad } from "./$types";
import z from "zod";
async function getBestSelling() {
const res = await fetch("http://localhost:8000/api/0/best-selling-products");
const res = await fetch(
`${import.meta.env.VITE_API_HOST}/api/0/best-selling-products`,
);
const json = await res.json();
return z
.array(