chore: Implement route protection and security enhancements
- Add src/middleware.ts for global route proection - Whitelist public routes (/, /auth/*, /splits/[slug]) - Add redirect logic to Home page for returning users - Fix minor lint issues in Home page
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { createClient } from '@/lib/supabase/client';
|
||||
import BottleGrid from "@/components/BottleGrid";
|
||||
import AuthForm from "@/components/AuthForm";
|
||||
@@ -11,7 +11,7 @@ import { useI18n } from "@/i18n/I18nContext";
|
||||
import { useAuth } from "@/context/AuthContext";
|
||||
import { useSession } from "@/context/SessionContext";
|
||||
import TastingHub from "@/components/TastingHub";
|
||||
import { Sparkles, Loader2, Search, SlidersHorizontal } from "lucide-react";
|
||||
import { Sparkles, Loader2, Search, SlidersHorizontal, Settings, CircleUser } from "lucide-react";
|
||||
import { BottomNavigation } from '@/components/BottomNavigation';
|
||||
import ScanAndTasteFlow from '@/components/ScanAndTasteFlow';
|
||||
import UserStatusBadge from '@/components/UserStatusBadge';
|
||||
@@ -20,10 +20,12 @@ import SplitCard from '@/components/SplitCard';
|
||||
import HeroBanner from '@/components/HeroBanner';
|
||||
import QuickActionsGrid from '@/components/QuickActionsGrid';
|
||||
import DramOfTheDay from '@/components/DramOfTheDay';
|
||||
import { checkIsAdmin } from '@/services/track-api-usage';
|
||||
|
||||
export default function Home() {
|
||||
const supabase = createClient();
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const [bottles, setBottles] = useState<any[]>([]);
|
||||
const { user, isLoading: isAuthLoading } = useAuth();
|
||||
const [isInternalLoading, setIsInternalLoading] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user