🐛 return to login if user was not found (probably deleted in db or token manipulated)🚸

This commit is contained in:
Timur Ercan
2023-03-09 11:24:32 +01:00
parent 02372eb6bc
commit 30e186d82a
5 changed files with 25 additions and 8 deletions

View File

@ -128,7 +128,13 @@ function getStat(name: string, props: any) {
export async function getServerSideProps(context: any) {
const user = await getUserFromToken(context.req, context.res);
if (!user) return;
if (!user)
return {
redirect: {
destination: "/login",
permanent: false,
},
};
const documents: any[] = await getDocumentsForUserFromToken(context);