fix: event type invalidation (#12077)
parent
9364055283
commit
0fb75b715d
|
@ -79,6 +79,7 @@ export default function CreateEventTypeDialog({
|
||||||
membershipRole: MembershipRole | null | undefined;
|
membershipRole: MembershipRole | null | undefined;
|
||||||
}[];
|
}[];
|
||||||
}) {
|
}) {
|
||||||
|
const utils = trpc.useContext();
|
||||||
const { t } = useLocale();
|
const { t } = useLocale();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [firstRender, setFirstRender] = useState(true);
|
const [firstRender, setFirstRender] = useState(true);
|
||||||
|
@ -116,6 +117,7 @@ export default function CreateEventTypeDialog({
|
||||||
|
|
||||||
const createMutation = trpc.viewer.eventTypes.create.useMutation({
|
const createMutation = trpc.viewer.eventTypes.create.useMutation({
|
||||||
onSuccess: async ({ eventType }) => {
|
onSuccess: async ({ eventType }) => {
|
||||||
|
await utils.viewer.eventTypes.getByViewer.invalidate();
|
||||||
await router.replace(`/event-types/${eventType.id}`);
|
await router.replace(`/event-types/${eventType.id}`);
|
||||||
showToast(
|
showToast(
|
||||||
t("event_type_created_successfully", {
|
t("event_type_created_successfully", {
|
||||||
|
|
Loading…
Reference in New Issue