sd
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
</b-nav-item>
|
||||
<b-nav-item to="/event" exact>
|
||||
<span>
|
||||
<font-awesome-icon icon="home" />
|
||||
<font-awesome-icon icon="th-list" />
|
||||
<span>All Events</span>
|
||||
</span>
|
||||
</b-nav-item>
|
||||
|
||||
@@ -6,6 +6,8 @@ import useDataUtils from '@/shared/data/data-utils.service';
|
||||
import { useDateFormat } from '@/shared/composables';
|
||||
import { type IRegistration } from '@/shared/model/registration.model';
|
||||
import { useAlertService } from '@/shared/alert/alert.service';
|
||||
import { type IUser, User } from '@/shared/model/user.model';
|
||||
import UserService from '@/entities/user/user.service';
|
||||
|
||||
export default defineComponent({
|
||||
compatConfig: { MODE: 3 },
|
||||
@@ -14,7 +16,9 @@ export default defineComponent({
|
||||
const dateFormat = useDateFormat();
|
||||
const registrationService = inject('registrationService', () => new RegistrationService());
|
||||
const alertService = inject('alertService', () => useAlertService(), true);
|
||||
|
||||
const userService = inject('userService', () => new UserService());
|
||||
// const loggedUser: Ref<IUser> = ref(new User());
|
||||
const currentUserId = ref('');
|
||||
const dataUtils = useDataUtils();
|
||||
|
||||
const route = useRoute();
|
||||
@@ -23,6 +27,13 @@ export default defineComponent({
|
||||
const previousState = () => router.go(-1);
|
||||
const registration: Ref<IRegistration> = ref({});
|
||||
|
||||
// Fetch user details from the /api/account endpoint
|
||||
userService()
|
||||
.fetchAccountDetails()
|
||||
.then(account => {
|
||||
currentUserId.value = `${account.id}`;
|
||||
});
|
||||
|
||||
const retrieveRegistration = async registrationId => {
|
||||
try {
|
||||
const res = await registrationService().find(registrationId);
|
||||
@@ -37,6 +48,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
return {
|
||||
currentUserId,
|
||||
...dateFormat,
|
||||
alertService,
|
||||
registration,
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<font-awesome-icon icon="arrow-left"></font-awesome-icon> <span>Back</span>
|
||||
</button>
|
||||
<router-link
|
||||
v-if="registration.id"
|
||||
v-if="registration.id && registration.user?.id == currentUserId"
|
||||
:to="{ name: 'RegistrationEdit', params: { registrationId: registration.id } }"
|
||||
custom
|
||||
v-slot="{ navigate }"
|
||||
|
||||
@@ -12,7 +12,7 @@ export const createRouter = () =>
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/event/3/view',
|
||||
redirect: '/event/1/view',
|
||||
},
|
||||
{
|
||||
path: '/forbidden',
|
||||
|
||||
Reference in New Issue
Block a user