fix: redirect user if not logged in

This commit is contained in:
Sonny
2023-06-04 23:54:51 +02:00
parent f1326bc06e
commit 9d4c3cbdd9
12 changed files with 67 additions and 22 deletions

View File

@@ -81,6 +81,13 @@ export default CreateCategory;
export async function getServerSideProps({ req, res }) {
const session = await getSession(req, res);
const user = await getUser(session);
if (!user) {
return {
redirect: {
destination: PATHS.HOME,
},
};
}
const categoriesCount = await getUserCategoriesCount(user);
return {