mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2026-01-21 21:08:29 -05:00
Update layout server and svelte files to use USING_VERCEL environment variable
This commit is contained in:
@@ -1,21 +1,17 @@
|
||||
import type { LayoutServerLoad, PageServerLoad } from "./$types";
|
||||
import { inject } from "@vercel/analytics";
|
||||
import { injectSpeedInsights } from "@vercel/speed-insights/sveltekit";
|
||||
|
||||
if (process.env.USING_VERCEL === "true") {
|
||||
inject();
|
||||
injectSpeedInsights();
|
||||
}
|
||||
import { USING_VERCEL } from "$env/static/private";
|
||||
|
||||
export const load: LayoutServerLoad = async (event) => {
|
||||
if (event.locals.user) {
|
||||
return {
|
||||
user: event.locals.user,
|
||||
isServerSetup: event.locals.isServerSetup,
|
||||
usingVercel: USING_VERCEL,
|
||||
};
|
||||
}
|
||||
return {
|
||||
user: null,
|
||||
isServerSetup: event.locals.isServerSetup,
|
||||
usingVercel: USING_VERCEL,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
import { goto } from "$app/navigation";
|
||||
import { onMount } from "svelte";
|
||||
import { page } from "$app/stores";
|
||||
import { inject } from "@vercel/analytics";
|
||||
import { injectSpeedInsights } from "@vercel/speed-insights/sveltekit";
|
||||
|
||||
if (data.usingVercel === "true") {
|
||||
inject();
|
||||
injectSpeedInsights();
|
||||
}
|
||||
|
||||
let isServerSetup = data.isServerSetup;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user