mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-04 20:55:19 +02:00
Update layout server and svelte files to use USING_VERCEL environment variable
This commit is contained in:
parent
a2c5b435e2
commit
ce2ea2f36f
2 changed files with 10 additions and 7 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue