Compare commits
1 commit
b3cb551f7c
...
83fe2c772c
Author | SHA1 | Date | |
---|---|---|---|
83fe2c772c |
2 changed files with 6 additions and 10 deletions
|
@ -8,7 +8,6 @@ import {
|
||||||
useDeleteApiEventEventID,
|
useDeleteApiEventEventID,
|
||||||
useGetApiEventEventID,
|
useGetApiEventEventID,
|
||||||
} from '@/generated/api/event/event';
|
} from '@/generated/api/event/event';
|
||||||
import { useGetApiUserMe } from '@/generated/api/user/user';
|
|
||||||
import { RedirectButton } from '@/components/buttons/redirect-button';
|
import { RedirectButton } from '@/components/buttons/redirect-button';
|
||||||
import { useSession } from 'next-auth/react';
|
import { useSession } from 'next-auth/react';
|
||||||
import ParticipantListEntry from '@/components/custom-ui/participant-list-entry';
|
import ParticipantListEntry from '@/components/custom-ui/participant-list-entry';
|
||||||
|
@ -35,10 +34,9 @@ export default function ShowEvent() {
|
||||||
|
|
||||||
// Fetch event data
|
// Fetch event data
|
||||||
const { data: eventData, isLoading, error } = useGetApiEventEventID(eventID);
|
const { data: eventData, isLoading, error } = useGetApiEventEventID(eventID);
|
||||||
const { data: userData, isLoading: userLoading } = useGetApiUserMe();
|
|
||||||
const deleteEvent = useDeleteApiEventEventID();
|
const deleteEvent = useDeleteApiEventEventID();
|
||||||
|
|
||||||
if (isLoading || userLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className='flex justify-center items-center h-full'>Loading...</div>
|
<div className='flex justify-center items-center h-full'>Loading...</div>
|
||||||
);
|
);
|
||||||
|
@ -143,7 +141,7 @@ export default function ShowEvent() {
|
||||||
Organiser:
|
Organiser:
|
||||||
</Label>
|
</Label>
|
||||||
<Label size='large'>
|
<Label size='large'>
|
||||||
{userData?.data.user?.name || 'Unknown User'}
|
{eventData.data.event.organizer.name || 'Unknown User'}
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,6 +30,7 @@ import {
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogTrigger,
|
DialogTrigger,
|
||||||
} from '../ui/dialog';
|
} from '../ui/dialog';
|
||||||
|
import { useGetApiUserMe } from '@/generated/api/user/user';
|
||||||
|
|
||||||
type User = zod.output<typeof PublicUserSchema>;
|
type User = zod.output<typeof PublicUserSchema>;
|
||||||
|
|
||||||
|
@ -56,13 +57,10 @@ const EventForm: React.FC<EventFormProps> = (props) => {
|
||||||
isSuccess,
|
isSuccess,
|
||||||
error,
|
error,
|
||||||
} = usePostApiEvent();
|
} = usePostApiEvent();
|
||||||
const {
|
const { data: eventData } = useGetApiEventEventID(props.eventId!, {
|
||||||
data: eventData,
|
|
||||||
isLoading,
|
|
||||||
isError,
|
|
||||||
} = useGetApiEventEventID(props.eventId!, {
|
|
||||||
query: { enabled: props.type === 'edit' },
|
query: { enabled: props.type === 'edit' },
|
||||||
});
|
});
|
||||||
|
const { data, isLoading, isError } = useGetApiUserMe();
|
||||||
const patchEvent = usePatchApiEventEventID();
|
const patchEvent = usePatchApiEventEventID();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -299,7 +297,7 @@ const EventForm: React.FC<EventFormProps> = (props) => {
|
||||||
<p className='text-[var(--color-neutral-300)]'>
|
<p className='text-[var(--color-neutral-300)]'>
|
||||||
{!isClient || isLoading
|
{!isClient || isLoading
|
||||||
? 'Loading...'
|
? 'Loading...'
|
||||||
: eventData?.data.event.organizer.name || 'Unknown User'}
|
: data?.data.user.name || 'Unknown User'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue