Fix changing event uuid didn't change event data
Closes #1192 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
e1469a5eec
commit
32706150e0
|
@ -10,11 +10,12 @@ export function useFetchEvent(uuid?: string) {
|
||||||
error,
|
error,
|
||||||
onError,
|
onError,
|
||||||
onResult,
|
onResult,
|
||||||
|
refetch,
|
||||||
} = useQuery<{ event: IEvent }>(
|
} = useQuery<{ event: IEvent }>(
|
||||||
FETCH_EVENT,
|
FETCH_EVENT,
|
||||||
{
|
() => ({
|
||||||
uuid,
|
uuid,
|
||||||
},
|
}),
|
||||||
() => ({
|
() => ({
|
||||||
enabled: uuid !== undefined,
|
enabled: uuid !== undefined,
|
||||||
})
|
})
|
||||||
|
@ -22,7 +23,7 @@ export function useFetchEvent(uuid?: string) {
|
||||||
|
|
||||||
const event = computed(() => fetchEventResult.value?.event);
|
const event = computed(() => fetchEventResult.value?.event);
|
||||||
|
|
||||||
return { event, loading, error, onError, onResult };
|
return { event, loading, error, onError, onResult, refetch };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useFetchEventBasic(uuid: string) {
|
export function useFetchEventBasic(uuid: string) {
|
||||||
|
|
|
@ -298,11 +298,19 @@ const props = defineProps<{
|
||||||
|
|
||||||
const { t } = useI18n({ useScope: "global" });
|
const { t } = useI18n({ useScope: "global" });
|
||||||
|
|
||||||
|
const propsUUID = computed(() => props.uuid)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
event,
|
event,
|
||||||
onError: onFetchEventError,
|
onError: onFetchEventError,
|
||||||
loading: eventLoading,
|
loading: eventLoading,
|
||||||
|
refetch: refetchEvent,
|
||||||
} = useFetchEvent(props.uuid);
|
} = useFetchEvent(props.uuid);
|
||||||
|
|
||||||
|
watch(propsUUID, (newUUid) => {
|
||||||
|
refetchEvent({ uuid: newUUid })
|
||||||
|
})
|
||||||
|
|
||||||
const eventId = computed(() => event.value?.id);
|
const eventId = computed(() => event.value?.id);
|
||||||
const { currentActor } = useCurrentActorClient();
|
const { currentActor } = useCurrentActorClient();
|
||||||
const currentActorId = computed(() => currentActor.value?.id);
|
const currentActorId = computed(() => currentActor.value?.id);
|
||||||
|
|
Loading…
Reference in a new issue