mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 08:23:55 +00:00
22 lines
529 B
TypeScript
22 lines
529 B
TypeScript
import axios from 'axios';
|
|
|
|
import { apiRepoLatest } from '../../externals';
|
|
|
|
import type { RequestOptions } from './requestOptions';
|
|
|
|
export type HasUpdate = {
|
|
url: string;
|
|
version: string;
|
|
};
|
|
|
|
/**
|
|
* HTTP request to get the latest version and url from github
|
|
*/
|
|
export async function getLatestVersion(options?: RequestOptions): Promise<HasUpdate> {
|
|
const res = await axios.get(apiRepoLatest, { signal: options?.signal });
|
|
return {
|
|
url: res.data.html_url as string,
|
|
version: res.data.tag_name as string,
|
|
};
|
|
}
|