sintonia_webapp/resources/js/composables/content/models/User.ts
2025-07-16 11:36:10 +02:00

31 lines
No EOL
808 B
TypeScript

import type {Show} from "@models/show/show";
import axios, {type AxiosResponse} from "axios";
export interface User {
id?: number;
login: string;
role: string;
firstName: string;
lastName: string;
email?: boolean;
cellPhone?: boolean;
timezone?: string;
show?: Show[];
}
export const getUser = async (options: {
role?: string | null;
withShow?: boolean;
}): Promise<User[]> => {
const filteredParams = Object.fromEntries(
Object.entries(options).filter(([_, value]) => value !== undefined && value !== null)
);
return await axios.get(`/user`, {params: filteredParams})
.then((response: AxiosResponse) => {
return response.data
}).catch((error: Error) => {
console.log("Error: " + error);
})
}