Quellcode durchsuchen

fix(ui): use useAuth hook for authentication check

Fszontagh vor 2 Tagen
Ursprung
Commit
10e616092e
1 geänderte Dateien mit 3 neuen und 4 gelöschten Zeilen
  1. 3 4
      src/components/ShareModal.tsx

+ 3 - 4
src/components/ShareModal.tsx

@@ -1,5 +1,5 @@
 import { useState, useEffect, useCallback } from 'react';
-import { useBaaS } from '@picobaas/client/react';
+import { useBaaS, useAuth } from '@picobaas/client/react';
 import type { ImageFile, ShareLink } from '../types';
 import { SHARE_LINK_EXPIRY_OPTIONS } from '../types';
 import { createShareLink, listShareLinks, revokeShareLink } from '../api/shareLinks';
@@ -12,15 +12,14 @@ interface ShareModalProps {
 }
 
 export default function ShareModal({ isOpen, onClose, image }: ShareModalProps) {
-  const { client, user } = useBaaS();
+  const { client } = useBaaS();
+  const { isAuthenticated } = useAuth();
   const [links, setLinks] = useState<ShareLink[]>([]);
   const [isLoading, setIsLoading] = useState(true);
   const [isCreating, setIsCreating] = useState(false);
   const [expiresIn, setExpiresIn] = useState(604800); // 7 days default
   const [error, setError] = useState<string | null>(null);
   const [copied, setCopied] = useState<string | null>(null);
-
-  const isAuthenticated = !!user;
   const activeLinks = links.filter(l => l.isValid && !l.isRevoked);
   const maxLinks = 10;