all repos — caroster @ c4db286e91b1e5d37351f3f282e87af7e230afc1

[Octree] Group carpool to your event https://caroster.io

🔒️ Redirect anonymous user to login for event options page
Tim Izzo tim@octree.ch
Wed, 15 Jan 2025 15:44:34 +0100
commit

c4db286e91b1e5d37351f3f282e87af7e230afc1

parent

85823c6589159d29cfc3a7f6e76a4bd92914ca40

1 files changed, 10 insertions(+), 1 deletions(-)

jump to
M frontend/pages/e/[uuid]/prices.tsxfrontend/pages/e/[uuid]/prices.tsx

@@ -9,7 +9,7 @@ import EventLayout, {TabComponent} from '../../../layouts/Event';

import useEventStore from '../../../stores/useEventStore'; import {Box, Container, Paper, useTheme} from '@mui/material'; import Head from 'next/head'; -import {useSession} from 'next-auth/react'; +import {getSession, useSession} from 'next-auth/react'; import pageUtils from '../../../lib/pageUtils'; import {getLocaleForLang} from '../../../lib/getLocale';

@@ -72,6 +72,15 @@ const {uuid} = context.query;

const {host = ''} = context.req.headers; let event = null; let modulesSettings = null; + + const session = await getSession(context); + if (!session) + return { + redirect: { + destination: `/auth/login?redirectPath=${context.resolvedUrl}`, + permanent: false, + }, + }; // Fetch event try {