From 5050621e28fd3a0268b799dfff5ee91aec730e7f Mon Sep 17 00:00:00 2001 From: ClaudiaHolhos Date: Mon, 10 Jan 2022 12:13:53 +0200 Subject: [PATCH] isValidUrl called directly, extra function removed --- src/@utils/provider.ts | 10 ---------- src/components/@shared/FormFields/Provider/index.tsx | 5 ++--- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/@utils/provider.ts b/src/@utils/provider.ts index bb6c47386..7c6097fcc 100644 --- a/src/@utils/provider.ts +++ b/src/@utils/provider.ts @@ -53,13 +53,3 @@ export async function getFileInfo( } } } - -export async function isValidProvider(url: string): Promise { - try { - const response = await ProviderInstance.isValidProvider(url, fetch) - return response - } catch (error) { - console.error(`Error validating provider: ${error.message}`) - return false - } -} diff --git a/src/components/@shared/FormFields/Provider/index.tsx b/src/components/@shared/FormFields/Provider/index.tsx index 1b6fbcd8a..f3f1609ad 100644 --- a/src/components/@shared/FormFields/Provider/index.tsx +++ b/src/components/@shared/FormFields/Provider/index.tsx @@ -6,7 +6,7 @@ import FileInfo from '../FilesInput/Info' import styles from './index.module.css' import Button from '@shared/atoms/Button' import { initialValues } from 'src/components/Publish/_constants' -import { isValidProvider } from '@utils/provider' +import { ProviderInstance } from '@oceanprotocol/lib' export default function CustomProvider(props: InputProps): ReactElement { const [field, meta, helpers] = useField(props.name) @@ -16,8 +16,7 @@ export default function CustomProvider(props: InputProps): ReactElement { setIsLoading(true) try { - // TODO: #948 Remove ocean.provider.isValidProvider dependency. - const isValid = await isValidProvider(url) + const isValid = await ProviderInstance.isValidProvider(url, fetch) helpers.setValue({ url, valid: isValid }) helpers.setError(undefined) } catch (error) {