diff options
| author | zwlucas <lucas.fariamo08@gmail.com> | 2026-05-29 21:24:59 +0000 |
|---|---|---|
| committer | zwlucas <lucas.fariamo08@gmail.com> | 2026-05-29 21:24:59 +0000 |
| commit | bf8b1d0d49703e82cf8162399405984bd0b3fe88 (patch) | |
| tree | af4ed5fb7feae49cb3ebe1c8c3f87831e53b8273 /frontend/src/hooks.server.js | |
| parent | 17b159c563278c3b3b8b3884be37f8d5025ce0c7 (diff) | |
| download | yaum-bf8b1d0d49703e82cf8162399405984bd0b3fe88.tar.gz yaum-bf8b1d0d49703e82cf8162399405984bd0b3fe88.zip | |
feat: implement static file serving and Docker support, update frontend build process
Signed-off-by: zwlucas <lucas.fariamo08@gmail.com>
Diffstat (limited to 'frontend/src/hooks.server.js')
| -rw-r--r-- | frontend/src/hooks.server.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/frontend/src/hooks.server.js b/frontend/src/hooks.server.js index 39c89e9..0c53a3d 100644 --- a/frontend/src/hooks.server.js +++ b/frontend/src/hooks.server.js @@ -1,7 +1,8 @@ import { redirect } from '@sveltejs/kit'; -const API = 'http://localhost:8080/api'; +import { building } from '$app/environment'; +const API_BASE = building ? 'http://localhost:8080/api' : '/api'; const PUBLIC_PREFIXES = ['/_app', '/api']; export async function handle({ event, resolve }) { @@ -18,7 +19,7 @@ export async function handle({ event, resolve }) { if (!token) { throw redirect(302, '/login'); } - const res = await fetch(`${API}/auth/verify`, { + const res = await fetch(`${API_BASE}/auth/verify`, { headers: { Authorization: `Bearer ${token}` } }); if (!res.ok) { |