feat: festival/event model frontend + topbar activeren
- Events lijst: card grid met festival/serie chips - Festival detail: programmaonderdelen grid - CreateSubEventDialog voor sub-events binnen festival - EventTabsNav: breadcrumb terug naar festival - Sessie A: festival-bewuste EventResource + children endpoint - Topbar: zoekbalk, theme switcher, shortcuts, notificaties - Schema v1.7 + BACKLOG.md toegevoegd - 121 tests groen
This commit is contained in:
@@ -3,7 +3,7 @@ import type { Ref } from 'vue'
|
||||
import { apiClient } from '@/lib/axios'
|
||||
import type {
|
||||
CreateEventPayload,
|
||||
EventType,
|
||||
EventItem,
|
||||
UpdateEventPayload,
|
||||
} from '@/types/event'
|
||||
|
||||
@@ -28,8 +28,9 @@ export function useEventList(orgId: Ref<string>) {
|
||||
return useQuery({
|
||||
queryKey: ['events', orgId],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.get<PaginatedResponse<EventType>>(
|
||||
const { data } = await apiClient.get<PaginatedResponse<EventItem>>(
|
||||
`/organisations/${orgId.value}/events`,
|
||||
{ params: { include_children: true } },
|
||||
)
|
||||
return data.data
|
||||
},
|
||||
@@ -41,7 +42,7 @@ export function useEventDetail(orgId: Ref<string>, id: Ref<string>) {
|
||||
return useQuery({
|
||||
queryKey: ['events', orgId, id],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.get<ApiResponse<EventType>>(
|
||||
const { data } = await apiClient.get<ApiResponse<EventItem>>(
|
||||
`/organisations/${orgId.value}/events/${id.value}`,
|
||||
)
|
||||
return data.data
|
||||
@@ -50,12 +51,42 @@ export function useEventDetail(orgId: Ref<string>, id: Ref<string>) {
|
||||
})
|
||||
}
|
||||
|
||||
export function useEventChildren(orgId: Ref<string>, eventId: Ref<string>) {
|
||||
return useQuery({
|
||||
queryKey: ['event-children', eventId],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.get<PaginatedResponse<EventItem>>(
|
||||
`/organisations/${orgId.value}/events/${eventId.value}/children`,
|
||||
)
|
||||
return data.data
|
||||
},
|
||||
enabled: () => !!orgId.value && !!eventId.value,
|
||||
})
|
||||
}
|
||||
|
||||
export function useCreateEvent(orgId: Ref<string>) {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (payload: CreateEventPayload) => {
|
||||
const { data } = await apiClient.post<ApiResponse<EventType>>(
|
||||
const { data } = await apiClient.post<ApiResponse<EventItem>>(
|
||||
`/organisations/${orgId.value}/events`,
|
||||
payload,
|
||||
)
|
||||
return data.data
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['events', orgId.value] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useCreateSubEvent(orgId: Ref<string>) {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (payload: CreateEventPayload) => {
|
||||
const { data } = await apiClient.post<ApiResponse<EventItem>>(
|
||||
`/organisations/${orgId.value}/events`,
|
||||
payload,
|
||||
)
|
||||
@@ -72,7 +103,7 @@ export function useUpdateEvent(orgId: Ref<string>, id: Ref<string>) {
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (payload: UpdateEventPayload) => {
|
||||
const { data } = await apiClient.put<ApiResponse<EventType>>(
|
||||
const { data } = await apiClient.put<ApiResponse<EventItem>>(
|
||||
`/organisations/${orgId.value}/events/${id.value}`,
|
||||
payload,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user