diff --git a/src/components/overview/AgendaView.vue b/src/components/overview/AgendaView.vue index 0147d4a..7c861cc 100644 --- a/src/components/overview/AgendaView.vue +++ b/src/components/overview/AgendaView.vue @@ -164,8 +164,8 @@ export default defineComponent({ const end = date.addToDate(start, { days: calendarDays.value }); events.value = {}; - const list = await store.getEvents({ from: start, to: end }); - list.forEach((event) => { + const { result } = await store.getEvents({ from: start, to: end }); + result.forEach((event) => { const day = event.start.getDay(); if (!events.value[day]) { diff --git a/src/components/overview/ListView.vue b/src/components/overview/ListView.vue index b04fa4c..0ec9e9e 100644 --- a/src/components/overview/ListView.vue +++ b/src/components/overview/ListView.vue @@ -94,21 +94,24 @@ export default defineComponent({ async function load(index: number, done?: (stop: boolean) => void) { const start = new Date(); if (index < 0) { - events.value.unshift(...(await store.getEvents({ to: start, limit: 5, descending: true }))); + const { result } = await store.getEvents({ to: start, limit: 5, descending: true }); + events.value.unshift(...result); if (done) done(false); } else { const len = events.value.length; - if ( - len == - events.value.push( - ...(await store.getEvents({ from: start, offset: (index - 1) * 10, limit: 10 })) - ) - ) { + const { result } = await store.getEvents({ + from: start, + offset: (index - 1) * 10, + limit: 10, + }); + if (len == events.value.push(...result)) { if (done) return done(true); - } else if (done) done(false); + } else if (done) done(false); } if (index <= 1) { - window.setTimeout(() => {(scrollDiv.value).scrollTop = document.getElementById("bbb")?.scrollHeight || 0}, 150); + window.setTimeout(() => { + (scrollDiv.value).scrollTop = document.getElementById('bbb')?.scrollHeight || 0; + }, 150); } } diff --git a/src/store/index.ts b/src/store/index.ts index 75f3ce9..9bede9b 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -107,13 +107,15 @@ export const useEventStore = defineStore({ }, async getEvents( - filter: - | { from?: Date; to?: Date; limit?: number; offset?: number; descending?: boolean } - | undefined = undefined + filter?: FG.PaginationFilter & { + user?: string; + } ) { try { - const { data } = await api.get('/events', { params: filter }); - data.forEach((element) => fixEvent(element)); + const { data } = await api.get>('/events', { + params: filter, + }); + data.result.forEach((element) => fixEvent(element)); return data; } catch (error) { throw error;