fix: guess correct timezone when onboarding (#6430)

* fix: guess correct timezone

* fix: redirect if on boarded

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
pull/6429/head
Nafees Nazik 2023-01-12 21:47:57 +05:30 committed by GitHub
parent e62d8b4596
commit 6414903567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -19,7 +19,8 @@ interface IUserSettingsProps {
const UserSettings = (props: IUserSettingsProps) => {
const { user, nextStep } = props;
const { t } = useLocale();
const [selectedTimeZone, setSelectedTimeZone] = useState(user.timeZone ?? dayjs.tz.guess());
const [selectedTimeZone, setSelectedTimeZone] = useState(dayjs.tz.guess());
const {
register,
handleSubmit,

View File

@ -178,6 +178,10 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
throw new Error("User from session not found");
}
if (user.completedOnboarding) {
return { redirect: { permanent: false, destination: "/event-types" } };
}
return {
props: {
...(await serverSideTranslations(context.locale ?? "", ["common"])),