web/version: don't try to fetch when server-side rendering

This commit is contained in:
dumbmoron 2024-09-03 13:33:16 +00:00
parent f009da7de4
commit 1262bc20fe
No known key found for this signature in database

View file

@ -1,5 +1,6 @@
import { readable } from "svelte/store";
import type { Optional } from "./types/generic";
import { browser } from "$app/environment";
type VersionResponse = {
commit: string;
@ -11,6 +12,8 @@ type VersionResponse = {
export const version = readable<Optional<VersionResponse>>(
undefined,
(set) => {
if (!browser) return;
fetch('/version.json')
.then(r => r.json())
.then(set)