feat(FE playlist): get playlist

This commit is contained in:
Michael 2025-03-30 23:32:48 +02:00
parent 5daec331f8
commit 03bae2faa7

View file

@ -1,4 +1,6 @@
import {VTextarea, VTextField} from "vuetify/components";
import axios, {type AxiosResponse} from "axios";
import type {Show} from "@models/show/show.ts";
export function playlist(item) {
const visibleFields = {
@ -34,4 +36,25 @@ export function playlist(item) {
// console.log(fields)
return fields
}
}
// TODO playlist interface
export const getPlaylist = async (options: {
id?: number | null;
scheduled?: number | null;
withDjs?: boolean | null;
isScheduled?: boolean | null;
page?: Number | null;
per_page?: Number | null;
all?: string | null;
}): Promise<Show[]> => {
const filteredParams = Object.fromEntries(
Object.entries(options).filter(([_, value]) => value !== undefined && value !== null)
);
return await axios.get(`/playlist`, {params: filteredParams})
.then((response: AxiosResponse) => {
return response.data.data
}).catch((error: Error) => {
console.log("Error: " + error);
})
}