Skip to content

Commit

Permalink
updates settings page to always route to temporal subpage (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei committed Dec 18, 2023
1 parent e5db348 commit 2eca3f4
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions frontend/apps/web/app/[account]/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,26 @@
import OverviewContainer from '@/components/containers/OverviewContainer';
import PageHeader from '@/components/headers/PageHeader';
import { useAccount } from '@/components/providers/account-provider';
import { useGetSystemAppConfig } from '@/libs/hooks/useGetSystemAppConfig';
import { UserAccountType } from '@neosync/sdk';
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { ReactElement, useEffect } from 'react';

export default function Settings() {
const { data: systemAppConfigData, isLoading: isSystemAppConfigDataLoading } =
useGetSystemAppConfig();
export default function Settings(): ReactElement {
const { account, isLoading: isAccountLoading } = useAccount();

const router = useRouter();

useEffect(() => {
if (isSystemAppConfigDataLoading || isAccountLoading) {
if (isAccountLoading) {
return;
}
if (
systemAppConfigData?.isAuthEnabled &&
account?.name &&
account.type === UserAccountType.TEAM
) {
return router.push(`/${account?.name}/settings/members`);
} else {
return router.push('/personal/settings/temporal');
}
}, [
account?.id,
isAccountLoading,
systemAppConfigData?.isAuthEnabled,
isSystemAppConfigDataLoading,
]);
const accountName = account?.name ?? 'personal';
return router.push(`/${accountName}/settings/temporal`);
}, [account?.name, isAccountLoading]);

return (
<OverviewContainer
Header={<PageHeader header="Settings" />}
containerClassName="settings-page"
>
<div></div>
<div />
</OverviewContainer>
);
}

0 comments on commit 2eca3f4

Please sign in to comment.