diff --git a/package.json b/package.json index e500866..51d3f8f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build && next export", + "build": "next build", "start": "next start" }, "dependencies": { diff --git a/pages/dashboard/guilds.js b/pages/dashboard/guilds.js index e971023..d1d6545 100644 --- a/pages/dashboard/guilds.js +++ b/pages/dashboard/guilds.js @@ -69,6 +69,16 @@ export async function getServerSideProps(ctx) { }) .catch((err) => console.log(err)); const { data } = res; + + if (!data) { + return { + redirect: { + destination: '/', + permanent: false, + }, + }; + } + return { props: { guilds: data, diff --git a/pages/dashboard/index.js b/pages/dashboard/index.js index bda49be..8d245e1 100644 --- a/pages/dashboard/index.js +++ b/pages/dashboard/index.js @@ -72,6 +72,16 @@ export async function getServerSideProps(ctx) { }, }) .catch((err) => console.log(err)); + + if (!newGuilds.data) { + return { + redirect: { + destination: '/', + permanent: false, + }, + }; + } + return { props: { guilds: newGuilds.data,