This commit is contained in:
2024-11-05 10:11:11 +01:00
parent 59bd5f6b78
commit c2bf40c1a4
80 changed files with 7291 additions and 1 deletions
@@ -0,0 +1,46 @@
import { type Ref, defineComponent, inject, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import EventService from './event.service';
import useDataUtils from '@/shared/data/data-utils.service';
import { type IEvent } from '@/shared/model/event.model';
import { useAlertService } from '@/shared/alert/alert.service';
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'EventDetails',
setup() {
const eventService = inject('eventService', () => new EventService());
const alertService = inject('alertService', () => useAlertService(), true);
const dataUtils = useDataUtils();
const route = useRoute();
const router = useRouter();
const previousState = () => router.go(-1);
const event: Ref<IEvent> = ref({});
const retrieveEvent = async eventId => {
try {
const res = await eventService().find(eventId);
event.value = res;
} catch (error) {
alertService.showHttpError(error.response);
}
};
if (route.params?.eventId) {
retrieveEvent(route.params.eventId);
}
return {
alertService,
event,
...dataUtils,
previousState,
};
},
});