feat(FE): axios helper func
This commit is contained in:
parent
bba0f09389
commit
a2630e8d4d
1 changed files with 4 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue