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 axios, {type AxiosResponse} from "axios";
|
||||||
import {dateFormatter} from "@/helpers/DateFormatter.ts";
|
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
|
||||||
|
|
||||||
export interface ShowDays {
|
export interface ShowDays {
|
||||||
id?: number;
|
id?: number;
|
||||||
|
@ -20,7 +18,7 @@ export interface ShowDays {
|
||||||
export const baseShowDays = ():ShowDays => {
|
export const baseShowDays = ():ShowDays => {
|
||||||
return {
|
return {
|
||||||
firstShow: new Date(),
|
firstShow: new Date(),
|
||||||
lastShow: new Date(),
|
lastShow: null,
|
||||||
startTime: '08:00',
|
startTime: '08:00',
|
||||||
timezone: '',
|
timezone: '',
|
||||||
duration: '01:00',
|
duration: '01:00',
|
||||||
|
@ -36,9 +34,8 @@ export const getShowDays = async (options: {
|
||||||
showId?: number | null;
|
showId?: number | null;
|
||||||
flattenShowDays?: boolean;
|
flattenShowDays?: boolean;
|
||||||
}): Promise<ShowDays> => {
|
}): Promise<ShowDays> => {
|
||||||
const filteredParams = Object.fromEntries(
|
const filteredParams = cleanOptions(options);
|
||||||
Object.entries(options).filter(([_, value]) => value !== undefined && value !== null)
|
|
||||||
);
|
|
||||||
return await axios.get(`/showDays`, {params: filteredParams})
|
return await axios.get(`/showDays`, {params: filteredParams})
|
||||||
.then((response: AxiosResponse) => {
|
.then((response: AxiosResponse) => {
|
||||||
return response.data
|
return response.data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue