mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
fix: redirect user if not logged in
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user