feat(FE): user model
This commit is contained in:
parent
d711b7a55e
commit
370def49d5
1 changed files with 30 additions and 0 deletions
30
resources/js/composables/content/models/User.ts
Normal file
30
resources/js/composables/content/models/User.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
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;
|
||||
|
||||
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);
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue