feat(FE): axios helper func

This commit is contained in:
Michael 2025-03-31 19:21:10 +02:00
parent 50a8497bf4
commit bba0f09389
4 changed files with 33 additions and 58 deletions

View file

@ -1,6 +1,7 @@
import {VTextarea, VTextField} from "vuetify/components";
import axios, {type AxiosResponse} from "axios";
import type {Show} from "@models/show/show.ts";
import {cleanOptions} from "@/helpers/AxiosHelper.ts";
export function playlist(item) {
const visibleFields = {
@ -48,9 +49,7 @@ export const getPlaylist = async (options: {
per_page?: Number | null;
all?: string | null;
}): Promise<Show[]> => {
const filteredParams = Object.fromEntries(
Object.entries(options).filter(([_, value]) => value !== undefined && value !== null)
);
const filteredParams = cleanOptions(options);
return await axios.get(`/playlist`, {params: filteredParams})
.then((response: AxiosResponse) => {
return response.data.data