mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 16:33:51 +00:00
0f57689750
* refactor: extract info component * feat: generate authenticated url * refactor: add companion select * refactor: ensure behaviour across environments
28 lines
646 B
TypeScript
28 lines
646 B
TypeScript
import axios from 'axios';
|
|
import { GetInfo } from 'ontime-types';
|
|
|
|
import { apiEntryUrl } from './constants';
|
|
|
|
const sessionPath = `${apiEntryUrl}/session`;
|
|
|
|
/**
|
|
* HTTP request to retrieve application info
|
|
*/
|
|
export async function getInfo(): Promise<GetInfo> {
|
|
const res = await axios.get(`${sessionPath}/info`);
|
|
return res.data;
|
|
}
|
|
|
|
/**
|
|
* HTTP request to get a pre-authenticated URL
|
|
*/
|
|
export async function generateUrl(
|
|
baseUrl: string,
|
|
path: string,
|
|
lock: boolean,
|
|
authenticate: boolean,
|
|
): Promise<string> {
|
|
const res = await axios.post(`${sessionPath}/url`, { baseUrl, path, lock, authenticate });
|
|
return res.data.url;
|
|
}
|