Show webui version from server

This commit is contained in:
Igor Katson 2023-12-07 12:19:35 +00:00
parent a01a07464c
commit 25ca003b44
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 39 additions and 19 deletions

View file

@ -46,7 +46,7 @@ const makeRequest = async (method: string, path: string, data?: any): Promise<an
return result;
}
export const API: RqbitAPI = {
export const API: RqbitAPI & { getVersion: () => Promise<string> } = {
listTorrents: (): Promise<ListTorrentsResponse> => makeRequest('GET', '/torrents'),
getTorrentDetails: (index: number): Promise<TorrentDetails> => {
return makeRequest('GET', `/torrents/${index}`);
@ -95,5 +95,9 @@ export const API: RqbitAPI = {
delete: (index: number): Promise<void> => {
return makeRequest('POST', `/torrents/${index}/delete`);
},
getVersion: async (): Promise<string> => {
const r = await makeRequest('GET', '/');
return r.version;
}
}