Add admin check. (#1716)

* Add admin check.

* Fix teamId check.
This commit is contained in:
Brian Cao 2022-12-27 15:18:58 -08:00 committed by GitHub
parent c90bd941b5
commit 561cde6e7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 133 additions and 98 deletions

View file

@ -3,12 +3,13 @@ import Layout from 'components/layout/Layout';
import TestConsole from 'components/pages/TestConsole';
import useRequireLogin from 'hooks/useRequireLogin';
import useUser from 'hooks/useUser';
import { ROLES } from 'lib/constants';
export default function ConsolePage({ pageDisabled }) {
const { loading } = useRequireLogin();
const { user } = useUser();
if (pageDisabled || loading || !user?.isAdmin) {
if (pageDisabled || loading || user?.role !== ROLES.admin) {
return null;
}