Fix updating slug (#4747)
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,
|
||||
|
|
Loading…
Reference in New Issue