mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
isValidUrl called directly, extra function removed
This commit is contained in:
parent
62ced13eaf
commit
5050621e28
@ -53,13 +53,3 @@ export async function getFileInfo(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function isValidProvider(url: string): Promise<boolean> {
|
||||
try {
|
||||
const response = await ProviderInstance.isValidProvider(url, fetch)
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error(`Error validating provider: ${error.message}`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user