|
|
@@ -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;
|
|
|
|