refactor: validation

This commit is contained in:
Carlos Valente
2023-12-01 13:08:05 +01:00
parent f720c56345
commit efcd6494be
20 changed files with 263 additions and 172 deletions
+5 -5
View File
@@ -3,12 +3,12 @@ import {
Alias,
DatabaseModel,
GetInfo,
HTTPSettings,
HttpSettings,
OntimeRundown,
OSCSettings,
OscSubscription,
ProjectData,
Settings,
Subscription,
UserFields,
ViewSettings,
} from 'ontime-types';
@@ -109,7 +109,7 @@ export async function getOSC(): Promise<OSCSettings> {
* @description HTTP request to retrieve http settings
* @return {Promise}
*/
export async function getHTTP(): Promise<HTTPSettings> {
export async function getHTTP(): Promise<HttpSettings> {
const res = await axios.get(`${ontimeURL}/http`);
return res.data;
}
@@ -118,7 +118,7 @@ export async function getHTTP(): Promise<HTTPSettings> {
* @description HTTP request to mutate http settings
* @return {Promise}
*/
export async function postHTTP(data: HTTPSettings) {
export async function postHTTP(data: HttpSettings) {
return axios.post(`${ontimeURL}/http`, data);
}
@@ -134,7 +134,7 @@ export async function postOSC(data: OSCSettings) {
* @description HTTP request to mutate osc subscriptions
* @return {Promise}
*/
export async function postOscSubscriptions(data: Subscription) {
export async function postOscSubscriptions(data: OscSubscription) {
return axios.post(`${ontimeURL}/osc-subscriptions`, data);
}
@@ -1,5 +1,5 @@
import { useMutation, useQuery } from '@tanstack/react-query';
import { HTTPSettings } from 'ontime-types';
import { HttpSettings } from 'ontime-types';
import { queryRefetchIntervalSlow } from '../../ontimeConfig';
import { HTTP_SETTINGS } from '../api/apiConstants';
@@ -20,7 +20,7 @@ export function useHttpSettings() {
});
// we need to jump through some hoops because of the type op port
return { data: data! as unknown as HTTPSettings, status, isFetching, isError, refetch };
return { data: data! as unknown as HttpSettings, status, isFetching, isError, refetch };
}
export function usePostHttpSettings() {
+2 -2
View File
@@ -1,6 +1,6 @@
import { HTTPSettings } from 'ontime-types';
import { HttpSettings } from 'ontime-types';
export const httpPlaceholder: HTTPSettings = {
export const httpPlaceholder: HttpSettings = {
enabledOut: false,
subscriptions: {
onLoad: [],