diff --git a/components/common/Modal.js b/components/common/Modal.js
index c2bca43f..42df57e2 100644
--- a/components/common/Modal.js
+++ b/components/common/Modal.js
@@ -1,16 +1,18 @@
import React from 'react';
+import ReactDOM from 'react-dom';
import { useSpring, animated } from 'react-spring';
import styles from './Modal.module.css';
export default function Modal({ title, children }) {
const props = useSpring({ opacity: 1, from: { opacity: 0 } });
- return (
+ return ReactDOM.createPortal(
{title &&
{title}
}
{children}
-
+ ,
+ document.getElementById('__modals'),
);
}
diff --git a/components/layout/Layout.js b/components/layout/Layout.js
index 1285f2c3..021745cc 100644
--- a/components/layout/Layout.js
+++ b/components/layout/Layout.js
@@ -16,6 +16,7 @@ export default function Layout({ title, children, header = true, footer = true }
{header && }
{children}
+
{footer && }
>
);
diff --git a/components/layout/MenuLayout.module.css b/components/layout/MenuLayout.module.css
index a0fa08ce..62233fd6 100644
--- a/components/layout/MenuLayout.module.css
+++ b/components/layout/MenuLayout.module.css
@@ -1,20 +1,15 @@
.container {
display: flex;
flex: 1;
- position: relative;
height: 100%;
}
.container .menu {
- display: flex;
- flex-direction: column;
padding: 30px 0;
border: 0;
}
.container .content {
- display: flex;
- flex-direction: column;
border-left: 1px solid var(--gray300);
padding-left: 30px;
}
diff --git a/lib/db.js b/lib/db.js
index d32b9f27..1d39c05b 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -33,8 +33,11 @@ if (process.env.NODE_ENV === 'production') {
export default prisma;
export async function runQuery(query) {
- return query.catch(e => {
- console.error(e);
- throw e;
- });
+ return query
+ .catch(e => {
+ console.error(e);
+ })
+ .finally(() => {
+ prisma.$disconnect();
+ });
}
diff --git a/lib/session.js b/lib/session.js
index 940decd9..9e57652a 100644
--- a/lib/session.js
+++ b/lib/session.js
@@ -10,12 +10,13 @@ export async function verifySession(req) {
}
const { website: website_uuid, hostname, screen, language, session } = payload;
- const token = await parseToken(session);
if (!isValidId(website_uuid)) {
throw new Error(`Invalid website: ${website_uuid}`);
}
+ const token = await parseToken(session);
+
if (!token || token.website_uuid !== website_uuid) {
const { userAgent, browser, os, ip, country, device } = await getClientInfo(req, payload);