Fix user logic.

This commit is contained in:
Mike Cao 2023-01-30 23:03:08 -08:00
parent 02a1438cfe
commit 89f2fd601e
5 changed files with 2 additions and 23 deletions

View File

@ -3,7 +3,7 @@ export default () => null;
export async function getServerSideProps() {
return {
redirect: {
destination: '/buttons/websites',
destination: '/settings/websites',
permanent: true,
},
};

View File

@ -1,17 +1,11 @@
import AppLayout from 'components/layout/AppLayout';
import TeamSettings from 'components/pages/settings/teams/TeamSettings';
import useUser from 'hooks/useUser';
import { useRouter } from 'next/router';
export default function TeamDetailPage() {
const { user } = useUser();
const router = useRouter();
const { id } = router.query;
if (!user) {
return null;
}
return (
<AppLayout>
<TeamSettings teamId={id} />

View File

@ -1,14 +1,7 @@
import AppLayout from 'components/layout/AppLayout';
import TeamsList from 'components/pages/settings/teams/TeamsList';
import useUser from 'hooks/useUser';
export default function TeamsPage() {
const { user } = useUser();
if (!user) {
return null;
}
return (
<AppLayout>
<TeamsList />

View File

@ -1,17 +1,11 @@
import AppLayout from 'components/layout/AppLayout';
import UserSettings from 'components/pages/settings/users/UserSettings';
import useUser from 'hooks/useUser';
import { useRouter } from 'next/router';
export default function TeamDetailPage() {
const { user } = useUser();
const router = useRouter();
const { id } = router.query;
if (!user) {
return null;
}
return (
<AppLayout>
<UserSettings userId={id} />

View File

@ -1,14 +1,12 @@
import AppLayout from 'components/layout/AppLayout';
import useConfig from 'hooks/useConfig';
import useUser from 'hooks/useUser';
import UsersList from 'components/pages/settings/users/UsersList';
export default function UsersPage() {
const { user } = useUser();
const { adminDisabled } = useConfig();
if (adminDisabled || !user) {
if (adminDisabled) {
return null;
}