diff --git a/components/pages/TestConsole.js b/components/pages/TestConsole.js index 70b0e504..4e80fcf8 100644 --- a/components/pages/TestConsole.js +++ b/components/pages/TestConsole.js @@ -12,7 +12,7 @@ import useFetch from 'hooks/useFetch'; import styles from './TestConsole.module.css'; export default function TestConsole() { - const { data } = useFetch('/websites'); + const { data } = useFetch('/websites?include_all=true'); const router = useRouter(); const { basePath, diff --git a/lib/auth.js b/lib/auth.js index eb061dce..7a44f360 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -49,8 +49,7 @@ export async function allowQuery(req, type) { const { id } = req.query; const { - user: { id: userId }, - isAdmin, + user: { id: userId, isAdmin }, shareToken, } = req.auth; diff --git a/pages/api/users/[id]/index.js b/pages/api/users/[id]/index.js index b8ac6f74..a373bbd1 100644 --- a/pages/api/users/[id]/index.js +++ b/pages/api/users/[id]/index.js @@ -5,7 +5,9 @@ import { useAuth } from 'lib/middleware'; export default async (req, res) => { await useAuth(req, res); - const { isAdmin, userId } = req.auth; + const { + user: { id: userId, isAdmin }, + } = req.auth; const { id } = req.query; if (req.method === 'GET') { diff --git a/pages/api/users/index.js b/pages/api/users/index.js index b80e65d9..f4a5010a 100644 --- a/pages/api/users/index.js +++ b/pages/api/users/index.js @@ -6,7 +6,9 @@ import { createUser, getUser, getUsers } from 'queries'; export default async (req, res) => { await useAuth(req, res); - const { isAdmin } = req.auth.user; + const { + user: { isAdmin }, + } = req.auth; if (!isAdmin) { return unauthorized(res); diff --git a/pages/api/websites/index.js b/pages/api/websites/index.js index 537d3865..3966ad70 100644 --- a/pages/api/websites/index.js +++ b/pages/api/websites/index.js @@ -8,8 +8,7 @@ export default async (req, res) => { await useAuth(req, res); const { - user: { id: userId }, - isAdmin, + user: { id: userId, isAdmin }, } = req.auth; if (req.method === 'GET') {