feat(ui): Add functions for getting a job and invitations to the events store
This commit is contained in:
parent
2ef9fd023a
commit
0f65ae53af
|
@ -28,6 +28,7 @@ export const useEventStore = defineStore({
|
|||
jobTypes: [] as FG.JobType[],
|
||||
eventTypes: [] as FG.EventType[],
|
||||
templates: [] as FG.Event[],
|
||||
invitations: [] as FG.Invitation[],
|
||||
}),
|
||||
|
||||
getters: {},
|
||||
|
@ -168,6 +169,10 @@ export const useEventStore = defineStore({
|
|||
.then(({ data }) => fixJob(data));
|
||||
},
|
||||
|
||||
async getJob(id: number) {
|
||||
return api.get<FG.Job>(`/events/jobs/${id}`).then(({ data }) => fixJob(data));
|
||||
},
|
||||
|
||||
async getJobs(filter?: FG.PaginationFilter) {
|
||||
return api
|
||||
.get<FG.PaginationResponse<FG.Job>>('/events/jobs', { params: <unknown>filter })
|
||||
|
@ -191,6 +196,14 @@ export const useEventStore = defineStore({
|
|||
});
|
||||
},
|
||||
|
||||
async getInvitations(force = false) {
|
||||
if (this.invitations.length == 0 || force) {
|
||||
const { data } = await api.get<FG.Invitation[]>('/events/invitations');
|
||||
this.invitations = data;
|
||||
}
|
||||
return this.invitations;
|
||||
},
|
||||
|
||||
async rejectInvitation(invite: FG.Invitation | number) {
|
||||
return api.delete(`/events/invitations/${typeof invite === 'number' ? invite : invite.id}`);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue