(null);
+ useEffect(() => {
+ if (token !== '') api.current = new CircleCI({ ...options, token });
+ }, [token]);
+
+ const { value, loading, error } = useAsync(() => {
+ if (api.current) return api.current.builds();
+ return Promise.reject('Api token not provided');
+ }, [token]);
+
+ if (loading) return loading
;
+ if (error) return {JSON.stringify(error, null, 2)}
;
+
+ return ;
};
export default ExampleFetchComponent;
diff --git a/plugins/circleci/src/plugin.ts b/plugins/circleci/src/plugin.ts
index 2c56b4eec2..4aec241bdb 100644
--- a/plugins/circleci/src/plugin.ts
+++ b/plugins/circleci/src/plugin.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { createPlugin } from '@backstage/core';
-import ExampleComponent from './components/ExampleFetchComponent';
+import ExampleComponent from './components/ExampleComponent';
export const plugin = createPlugin({
id: 'circleci',