Refactor route protection by replacing ProtectedRoute with ClientRouteGuard in analytics, create-shorturl, and links pages to standardize authentication handling across the application.

This commit is contained in:
2025-04-24 01:41:44 +08:00
parent d80d5e976b
commit 3162836e91
4 changed files with 67 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import { Loader2, ExternalLink, Search } from 'lucide-react';
import { TeamSelector } from '@/app/components/ui/TeamSelector';
import { useRouter } from 'next/navigation';
import { useShortUrlStore, ShortUrlData } from '@/app/utils/store';
import ClientRouteGuard from '@/app/components/ClientRouteGuard';
// Define attribute type to avoid using 'any'
interface LinkAttributes {
@@ -102,6 +103,14 @@ const convertClickHouseToShortLink = (data: Record<string, unknown>): ShortLink
};
export default function LinksPage() {
return (
<ClientRouteGuard>
<LinksPageContent />
</ClientRouteGuard>
);
}
function LinksPageContent() {
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [links, setLinks] = useState<ShortLink[]>([]);