Fix updating slug (#4747)

This commit is contained in:
Leo Giovanetti
2022-09-28 23:07:55 +01:00
committed by GitHub
parent f5faebad67
commit 7256dbf84f
@@ -96,7 +96,8 @@ export type EventTypeSetupInfered = inferSSRProps<typeof getServerSideProps>;
const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
const { t } = useLocale();
const { eventType, locationOptions, team, teamMembers } = props;
const { eventType: dbEventType, locationOptions, team, teamMembers } = props;
const [eventType, setEventType] = useState(dbEventType);
const animationParentRef = useRef(null);
const router = useRouter();
const { tabName } = querySchema.parse(router.query);
@@ -106,7 +107,8 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
}, [animationParentRef]);
const updateMutation = trpc.useMutation("viewer.eventTypes.update", {
onSuccess: async ({ eventType }) => {
onSuccess: async ({ eventType: newEventType }) => {
setEventType({ ...eventType, slug: newEventType.slug });
showToast(
t("event_type_updated_successfully", {
eventTypeTitle: eventType.title,