cobalt/web/src/lib/version.ts

20 lines
414 B
TypeScript
Raw Normal View History

2024-07-20 13:43:14 +01:00
import { readable } from "svelte/store";
import type { Optional } from "./types/generic";
2024-07-20 13:43:14 +01:00
type VersionResponse = {
commit: string;
branch: string;
remote: string;
version: string;
}
export const version = readable<Optional<VersionResponse>>(
undefined,
2024-07-20 13:43:14 +01:00
(set) => {
fetch('/version.json')
.then(r => r.json())
.then(set)
.catch(() => {})
}
2024-07-20 13:43:14 +01:00
)