mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 05:05:17 +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 type { LayoutServerLoad, PageServerLoad } from "./$types";
|
||||||
import { inject } from "@vercel/analytics";
|
import { USING_VERCEL } from "$env/static/private";
|
||||||
import { injectSpeedInsights } from "@vercel/speed-insights/sveltekit";
|
|
||||||
|
|
||||||
if (process.env.USING_VERCEL === "true") {
|
|
||||||
inject();
|
|
||||||
injectSpeedInsights();
|
|
||||||
}
|
|
||||||
|
|
||||||
export const load: LayoutServerLoad = async (event) => {
|
export const load: LayoutServerLoad = async (event) => {
|
||||||
if (event.locals.user) {
|
if (event.locals.user) {
|
||||||
return {
|
return {
|
||||||
user: event.locals.user,
|
user: event.locals.user,
|
||||||
isServerSetup: event.locals.isServerSetup,
|
isServerSetup: event.locals.isServerSetup,
|
||||||
|
usingVercel: USING_VERCEL,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
user: null,
|
user: null,
|
||||||
isServerSetup: event.locals.isServerSetup,
|
isServerSetup: event.locals.isServerSetup,
|
||||||
|
usingVercel: USING_VERCEL,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,6 +7,13 @@
|
||||||
import { goto } from "$app/navigation";
|
import { goto } from "$app/navigation";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { page } from "$app/stores";
|
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;
|
let isServerSetup = data.isServerSetup;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue