feat: use dynamic environment variable import
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { STRAPI_API_KEY } from '$env/static/private';
|
||||
import { PUBLIC_STRAPI_URL } from '$env/static/public';
|
||||
import { env as privateEnv } from '$env/dynamic/private';
|
||||
import { env as publicEnv } from '$env/dynamic/public';
|
||||
import type { LayoutServerLoad } from './$types';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { mapFooterData, mapHeaderData } from '$lib/mapping/strapiMapping.svelte.js';
|
||||
@@ -24,13 +24,13 @@ export const load: LayoutServerLoad = async () => {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${STRAPI_API_KEY}`
|
||||
Authorization: `Bearer ${privateEnv.STRAPI_API_KEY}`
|
||||
}
|
||||
};
|
||||
|
||||
const [homepageResponse, footerResponse] = await Promise.allSettled([
|
||||
fetch(`${PUBLIC_STRAPI_URL}/api/homepage?${query}`, requestInit),
|
||||
fetch(`${PUBLIC_STRAPI_URL}/api/footer`, requestInit)
|
||||
fetch(`${publicEnv.PUBLIC_STRAPI_URL}/api/homepage?${query}`, requestInit),
|
||||
fetch(`${publicEnv.PUBLIC_STRAPI_URL}/api/footer`, requestInit)
|
||||
]);
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user