mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-16 05:09:57 +00:00
24 lines
497 B
TypeScript
24 lines
497 B
TypeScript
|
type VersionResponse = {
|
||
|
commit: string;
|
||
|
branch: string;
|
||
|
remote: string;
|
||
|
version: string;
|
||
|
}
|
||
|
|
||
|
const fetchVersion = async function () {
|
||
|
const response: VersionResponse | undefined = await fetch('/version.json')
|
||
|
.then(r => r.json())
|
||
|
.catch(() => {});
|
||
|
|
||
|
if (!response) return {
|
||
|
commit: "unknown",
|
||
|
branch: "unknown",
|
||
|
remote: "unknown",
|
||
|
version: "unknown"
|
||
|
}
|
||
|
|
||
|
return response;
|
||
|
}
|
||
|
|
||
|
export const version = await fetchVersion();
|