sintonia_webapp/resources/js/composables/content/models/show/showDays.ts

45 lines
No EOL
1.1 KiB
TypeScript

import axios, {type AxiosResponse} from "axios";
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
export interface ShowDays {
id?: number;
firstShow: Date;
lastShow: Date;
startTime: string;
timezone: string;
duration: string;
day: number[];
repeatType: number;
nextPopDate?: string;
showId?: number;
record?: number;
}
export const baseShowDays = ():ShowDays => {
return {
firstShow: new Date(),
lastShow: null,
startTime: '08:00',
timezone: '',
duration: '01:00',
day: [0],
repeatType: 0,
nextPopDate: '',
showId: 0,
record: 0
};
}
export const getShowDays = async (options: {
showId?: number | null;
flattenShowDays?: boolean;
}): Promise<ShowDays> => {
const filteredParams = cleanOptions(options);
return await axios.get(`/showDays`, {params: filteredParams})
.then((response: AxiosResponse) => {
return response.data
}).catch((error: Error) => {
console.log("Error: " + error);
})
}