mirror of
https://github.com/wukko/cobalt.git
synced 2025-02-06 10:46:22 +01:00
22 lines
489 B
TypeScript
22 lines
489 B
TypeScript
import { readable } from "svelte/store";
|
|
import type { Optional } from "./types/generic";
|
|
import { browser } from "$app/environment";
|
|
|
|
type VersionResponse = {
|
|
commit: string;
|
|
branch: string;
|
|
remote: string;
|
|
version: string;
|
|
}
|
|
|
|
export const version = readable<Optional<VersionResponse>>(
|
|
undefined,
|
|
(set) => {
|
|
if (!browser) return;
|
|
|
|
fetch('/version.json')
|
|
.then(r => r.json())
|
|
.then(set)
|
|
.catch(() => {})
|
|
}
|
|
)
|