mirror of
https://github.com/oceanprotocol/market.git
synced 2024-06-30 05:41:41 +02:00
Merge branch 'v4' into feature/publish
This commit is contained in:
commit
a235255cc0
|
@ -1,7 +1,6 @@
|
|||
import { useState } from 'react'
|
||||
import { consumeFeedback } from '@utils/feedback'
|
||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||
import { useOcean } from '@context/Ocean'
|
||||
import { useWeb3 } from '@context/Web3'
|
||||
|
||||
interface UseConsume {
|
||||
|
|
|
@ -42,12 +42,11 @@ export async function getFileInfo(
|
|||
providerUrl: string,
|
||||
cancelToken: CancelToken
|
||||
): Promise<FileInfo[]> {
|
||||
let postBody
|
||||
try {
|
||||
// TODO: what was the point of this?
|
||||
// if (url instanceof DID) postBody = { did: url.getDid() }
|
||||
// else postBody = { url }
|
||||
postBody = { url: url, type: 'url' }
|
||||
const postBody = { url, type: 'url' }
|
||||
const response: AxiosResponse<FileInfo[]> = await axios.post(
|
||||
`${providerUrl}/api/services/fileinfo`,
|
||||
postBody,
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
import React, { ReactElement, useState } from 'react'
|
||||
import { ErrorMessage, useField } from 'formik'
|
||||
import UrlInput from '../URLInput'
|
||||
import { useOcean } from '@context/Ocean'
|
||||
import { InputProps } from '@shared/FormInput'
|
||||
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 { ProviderInstance } from '@oceanprotocol/lib'
|
||||
|
||||
export default function CustomProvider(props: InputProps): ReactElement {
|
||||
const [field, meta, helpers] = useField(props.name)
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const { ocean, config } = useOcean()
|
||||
|
||||
async function validateProvider(url: string) {
|
||||
setIsLoading(true)
|
||||
|
||||
try {
|
||||
// TODO: #948 Remove ocean.provider.isValidProvider dependency.
|
||||
const isValid = await ocean.provider.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