feat: create project list (#671)

This commit is contained in:
Carlos Valente
2024-01-06 21:38:16 +01:00
committed by GitHub
parent 65a5aaa665
commit bac2dc6b87
15 changed files with 220 additions and 34 deletions
+7 -6
View File
@@ -1,14 +1,15 @@
// REST stuff
export const PROJECT_DATA = ['project'];
export const ALIASES = ['aliases'];
export const USERFIELDS = ['userFields'];
export const RUNDOWN = ['rundown'];
export const APP_INFO = ['appinfo'];
export const OSC_SETTINGS = ['oscSettings'];
export const HTTP_SETTINGS = ['httpSettings'];
export const APP_SETTINGS = ['appSettings'];
export const VIEW_SETTINGS = ['viewSettings'];
export const HTTP_SETTINGS = ['httpSettings'];
export const OSC_SETTINGS = ['oscSettings'];
export const PROJECT_DATA = ['project'];
export const PROJECT_LIST = ['projectList'];
export const RUNDOWN = ['rundown'];
export const RUNTIME = ['runtimeStore'];
export const USERFIELDS = ['userFields'];
export const VIEW_SETTINGS = ['viewSettings'];
const location = window.location;
const socketProtocol = location.protocol === 'https:' ? 'wss' : 'ws';
+12
View File
@@ -8,6 +8,7 @@ import {
OSCSettings,
OscSubscription,
ProjectData,
ProjectFileListResponse,
Settings,
UserFields,
ViewSettings,
@@ -242,6 +243,17 @@ export async function getLatestVersion(): Promise<HasUpdate> {
};
}
/**
* @description HTTP POST request to create a new project file with given project data
*/
export async function postNew(initialData: Partial<ProjectData>) {
return axios.post(`${ontimeURL}/new`, initialData);
}
/**
* @description HTTP request to get the list of available project files
*/
export async function getProjects(): Promise<ProjectFileListResponse> {
const res = await axios.get(`${ontimeURL}/projects`);
return res.data;
}