- {loading && (
+ {assetError ? (
+
+ {t('plugins.loadFailed')}
+
+ ) : loading || !assetUrl ? (
Loading...
+ ) : null}
+ {!assetError && assetUrl && (
+
);
}
diff --git a/web/src/hooks/useAuthenticatedPluginResource.ts b/web/src/hooks/useAuthenticatedPluginResource.ts
index 8ec46df27..c271d99ff 100644
--- a/web/src/hooks/useAuthenticatedPluginResource.ts
+++ b/web/src/hooks/useAuthenticatedPluginResource.ts
@@ -1,41 +1,63 @@
import { useEffect, useState } from 'react';
import { httpClient } from '@/app/infra/http/HttpClient';
+import { useCurrentWorkspace } from '@/app/infra/http';
+
+type AuthenticatedResourceState = {
+ key: string;
+ url: string;
+ error: boolean;
+};
+
+const EMPTY_RESOURCE: AuthenticatedResourceState = {
+ key: '',
+ url: '',
+ error: false,
+};
export function useAuthenticatedPluginIcon(
author: string,
name: string,
enabled = true,
): { url: string; error: boolean } {
- const [url, setURL] = useState('');
- const [error, setError] = useState(false);
+ const [resource, setResource] =
+ useState