mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 17:38:31 +00:00
web/version: don't try to fetch when server-side rendering
This commit is contained in:
parent
f009da7de4
commit
1262bc20fe
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user