feat: enforce 12-hour limit for active tasting sessions
This commit is contained in:
@@ -8,6 +8,7 @@ import TastingNoteForm from '@/components/TastingNoteForm';
|
||||
import StatusSwitcher from '@/components/StatusSwitcher';
|
||||
import TastingList from '@/components/TastingList';
|
||||
import DeleteBottleButton from '@/components/DeleteBottleButton';
|
||||
import { validateSession } from '@/services/validate-session';
|
||||
|
||||
export default async function BottlePage({
|
||||
params,
|
||||
@@ -16,7 +17,15 @@ export default async function BottlePage({
|
||||
params: { id: string },
|
||||
searchParams: { session_id?: string }
|
||||
}) {
|
||||
const sessionId = searchParams.session_id;
|
||||
let sessionId = searchParams.session_id;
|
||||
|
||||
// Validate Session Age (12 hour limit)
|
||||
if (sessionId) {
|
||||
const isValid = await validateSession(sessionId);
|
||||
if (!isValid) {
|
||||
sessionId = undefined;
|
||||
}
|
||||
}
|
||||
const supabase = createServerComponentClient({ cookies });
|
||||
|
||||
const { data: bottle } = await supabase
|
||||
|
||||
Reference in New Issue
Block a user