fix and update

This commit is contained in:
lendry
2026-06-30 10:36:21 +03:00
parent a76997986a
commit 7f10b18336
6 changed files with 73 additions and 29 deletions

View File

@@ -12,12 +12,12 @@ interface AvatarAccessResponse {
}
export function useAvatarUrl(userId: string | undefined, hasAvatar: boolean | undefined, token: string | null) {
const { isPinLocked, isLoading, isApiReady } = useAuth();
const { isPinLocked, isLoading, isContentReady } = useAuth();
const [accessUrl, setAccessUrl] = useState<string | null>(null);
const [resolvingAccessUrl, setResolvingAccessUrl] = useState(false);
const refreshAccessUrl = useCallback(async () => {
if (!userId || !token || !hasAvatar || isPinLocked || isLoading || !isApiReady) {
if (!userId || !token || !hasAvatar || isPinLocked || isLoading || !isContentReady) {
setAccessUrl(null);
setResolvingAccessUrl(false);
return;
@@ -31,7 +31,7 @@ export function useAvatarUrl(userId: string | undefined, hasAvatar: boolean | un
} finally {
setResolvingAccessUrl(false);
}
}, [hasAvatar, isApiReady, isLoading, isPinLocked, token, userId]);
}, [hasAvatar, isContentReady, isLoading, isPinLocked, token, userId]);
useEffect(() => {
void refreshAccessUrl();
@@ -59,7 +59,7 @@ export function useAvatarUrl(userId: string | undefined, hasAvatar: boolean | un
isLoading: isLoadingBlob,
hasError
} = useResilientBlobUrl(accessUrl, token, {
enabled: Boolean(hasAvatar && accessUrl && !isPinLocked && !isLoading && isApiReady),
enabled: Boolean(hasAvatar && accessUrl && !isPinLocked && !isLoading && isContentReady),
label: `аватар ${userId ?? ''}`.trim()
});