feat(FE): axios helper func

This commit is contained in:
Michael 2025-03-31 19:21:20 +02:00
parent bba0f09389
commit a2630e8d4d

View file

@ -1,7 +1,5 @@
import { VSelect, VTextField } from "vuetify/components";
import type {Show} from "@models/show/show";
import axios, {type AxiosResponse} from "axios";
import {dateFormatter} from "@/helpers/DateFormatter.ts";
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
export interface ShowDays {
id?: number;
@ -20,7 +18,7 @@ export interface ShowDays {
export const baseShowDays = ():ShowDays => {
return {
firstShow: new Date(),
lastShow: new Date(),
lastShow: null,
startTime: '08:00',
timezone: '',
duration: '01:00',
@ -36,9 +34,8 @@ export const getShowDays = async (options: {
showId?: number | null;
flattenShowDays?: boolean;
}): Promise<ShowDays> => {
const filteredParams = Object.fromEntries(
Object.entries(options).filter(([_, value]) => value !== undefined && value !== null)
);
const filteredParams = cleanOptions(options);
return await axios.get(`/showDays`, {params: filteredParams})
.then((response: AxiosResponse) => {
return response.data