Updated login and layout pages.

This commit is contained in:
Mike Cao 2023-01-11 14:47:38 -08:00
parent 9d967fb0fe
commit 4f15c4f146
18 changed files with 103 additions and 106 deletions

View file

@ -1,23 +1,23 @@
import Layout from 'components/layout/Layout';
import AppLayout from 'components/layout/AppLayout';
import Menu from 'components/nav/Nav';
import useRequireLogin from 'hooks/useRequireLogin';
import styles from './SettingsLayout.module.css';
import useConfig from 'hooks/useConfig';
export default function SettingsLayout({ children }) {
const { user } = useRequireLogin();
const { adminDisabled } = useConfig();
if (!user) {
if (adminDisabled) {
return null;
}
return (
<Layout>
<AppLayout>
<div className={styles.dashboard}>
<div className={styles.nav}>
<Menu />
</div>
<div className={styles.content}>{children}</div>
</div>
</Layout>
</AppLayout>
);
}

View file

@ -12,8 +12,10 @@ export default function WebsitesList() {
const [edit, setEdit] = useState(false);
const { get, useQuery } = useApi();
const { user } = useUser();
const { data, isLoading, error, refetch } = useQuery(['websites', user.id], () =>
get(`/users/${user.id}/websites`),
const { data, isLoading, error, refetch } = useQuery(
['websites', user?.id],
() => get(`/users/${user?.id}/websites`),
{ enabled: !!user },
);
const hasData = data && data.length !== 0;
const { toast, showToast } = useToast();