This commit is contained in:
Omer Sabic 2024-05-29 22:42:08 +02:00
parent 72a7841748
commit 37ac187e6e
4 changed files with 7 additions and 5 deletions

0
.env.example Normal file
View File

View File

@ -3,6 +3,6 @@ import { redirect } from '@sveltejs/kit';
/** @type {import('@sveltejs/kit').Handle} */ /** @type {import('@sveltejs/kit').Handle} */
export async function handle({ event, resolve }) { export async function handle({ event, resolve }) {
if(new URL(event.request.url).host === env.sites_host) redirect(302, env.youpage) if(new URL(event.request.url).host === env.sites_host) redirect(302, env.frontend_url)
return resolve(event); return resolve(event);
} }

View File

@ -1,5 +1,7 @@
import { env as e } from '$env/dynamic/public'
export const env = { export const env = {
api_url: "http://localhost:3000", api_url: e.PUBLIC_API_URL || "",
youpage: "http://localhost:3002", frontend_url: e.PUBLIC_FRONTEND_URL || "",
sites_host: "127.0.0.1.nip.io:3001" sites_url: e.PUBLIC_SITES_URL || ""
} }

View File

@ -5,7 +5,7 @@ import { env } from "$lib";
export async function load(event) { export async function load(event) {
let res = await event.fetch(env.api_url + "/blog"); let res = await event.fetch(env.api_url + "/blog");
if (!res.ok) { if (!res.ok) {
redirect(302, env.youpage); redirect(302, env.frontend_url);
} }
let blog_info = await res.json(); let blog_info = await res.json();