From 2007af7d8b4414e95e479bba1ef2c9367a58ad16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20de=20Vasconcelos?= Date: Fri, 17 Nov 2023 13:20:46 +0000 Subject: [PATCH] Cleanup --- .../JobsExplorerTableRowItem/JobsExplorerTableRowItem.js | 4 ++-- manager/pages/api/jobs/[_id]/delete.js | 2 +- manager/pages/api/jobs/[_id]/update/status/[status].js | 2 +- manager/pages/api/jobs/create.js | 2 +- manager/pages/api/jobs/index.js | 2 +- manager/pages/api/users/[_id]/delete.js | 2 +- manager/pages/api/users/index.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manager/components/JobsExplorerTableRowItem/JobsExplorerTableRowItem.js b/manager/components/JobsExplorerTableRowItem/JobsExplorerTableRowItem.js index b633a97..7e8c52b 100644 --- a/manager/components/JobsExplorerTableRowItem/JobsExplorerTableRowItem.js +++ b/manager/components/JobsExplorerTableRowItem/JobsExplorerTableRowItem.js @@ -43,10 +43,10 @@ export default function JobsExplorerTableRowItem({ jobData }) {
{jobData.gdpr_consent || '(empty)'}
{jobData.render_host || '(empty)'}
-
{jobData.render_path.substring(0, 30) || '(empty)'}
+
{jobData.render_path?.substring(0, 30) || '(empty)'}
{jobData.render_format || '(empty)'}
-
{jobData.filename.substring(0, 30) || '(empty)'}
+
{jobData.filename?.substring(0, 30) || '(empty)'}
); diff --git a/manager/pages/api/jobs/[_id]/delete.js b/manager/pages/api/jobs/[_id]/delete.js index 7812917..15ac26e 100644 --- a/manager/pages/api/jobs/[_id]/delete.js +++ b/manager/pages/api/jobs/[_id]/delete.js @@ -24,7 +24,7 @@ export default async function handler(req, res) { try { const session = await getServerSession(req, res, authOptions); - if (!session) throw new Error('You must be logged in to access this feature.'); + if (!session?.user?.email?.length) throw new Error('You must be logged in to access this feature.'); } catch (err) { console.log(err); return await res.status(401).json({ message: err.message || 'Could not verify Authentication.' }); diff --git a/manager/pages/api/jobs/[_id]/update/status/[status].js b/manager/pages/api/jobs/[_id]/update/status/[status].js index 672d4ae..5072860 100644 --- a/manager/pages/api/jobs/[_id]/update/status/[status].js +++ b/manager/pages/api/jobs/[_id]/update/status/[status].js @@ -24,7 +24,7 @@ export default async function handler(req, res) { try { const session = await getServerSession(req, res, authOptions); - if (!session) throw new Error('You must be logged in to access this feature.'); + if (!session?.user?.email?.length) throw new Error('You must be logged in to access this feature.'); } catch (err) { console.log(err); return await res.status(401).json({ message: err.message || 'Could not verify Authentication.' }); diff --git a/manager/pages/api/jobs/create.js b/manager/pages/api/jobs/create.js index bd5e07d..f106816 100644 --- a/manager/pages/api/jobs/create.js +++ b/manager/pages/api/jobs/create.js @@ -24,7 +24,7 @@ export default async function handler(req, res) { try { const session = await getServerSession(req, res, authOptions); - if (!session) throw new Error('You must be logged in to access this feature.'); + if (!session?.user?.email?.length) throw new Error('You must be logged in to access this feature.'); } catch (err) { console.log(err); return await res.status(401).json({ message: err.message || 'Could not verify Authentication.' }); diff --git a/manager/pages/api/jobs/index.js b/manager/pages/api/jobs/index.js index 492ebbe..856fbcc 100644 --- a/manager/pages/api/jobs/index.js +++ b/manager/pages/api/jobs/index.js @@ -24,7 +24,7 @@ export default async function handler(req, res) { try { const session = await getServerSession(req, res, authOptions); - if (!session) throw new Error('You must be logged in to access this feature.'); + if (!session?.user?.email?.length) throw new Error('You must be logged in to access this feature.'); } catch (err) { console.log(err); return await res.status(401).json({ message: err.message || 'Could not verify Authentication.' }); diff --git a/manager/pages/api/users/[_id]/delete.js b/manager/pages/api/users/[_id]/delete.js index 1eec08e..ddf4275 100644 --- a/manager/pages/api/users/[_id]/delete.js +++ b/manager/pages/api/users/[_id]/delete.js @@ -24,7 +24,7 @@ export default async function handler(req, res) { try { const session = await getServerSession(req, res, authOptions); - if (!session) throw new Error('You must be logged in to access this feature.'); + if (!session?.user?.email?.length) throw new Error('You must be logged in to access this feature.'); } catch (err) { console.log(err); return await res.status(401).json({ message: err.message || 'Could not verify Authentication.' }); diff --git a/manager/pages/api/users/index.js b/manager/pages/api/users/index.js index fcfea2c..214262d 100644 --- a/manager/pages/api/users/index.js +++ b/manager/pages/api/users/index.js @@ -24,7 +24,7 @@ export default async function handler(req, res) { try { const session = await getServerSession(req, res, authOptions); - if (!session) throw new Error('You must be logged in to access this feature.'); + if (!session?.user?.email?.length) throw new Error('You must be logged in to access this feature.'); } catch (err) { console.log(err); return await res.status(401).json({ message: err.message || 'Could not verify Authentication.' });