1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

working check

This commit is contained in:
ClaudiaHolhos 2021-12-14 14:59:16 +02:00
parent 1669df0e78
commit e028dd9674

View File

@ -54,11 +54,11 @@ export async function getFileInfo(
}
}
export async function fetchMethod(url: string): Promise<AxiosResponse> {
const result = await axios.get(url)
async function fetchMethod(url: string): Promise<Response> {
const result = await fetch(url)
if (!result) {
console.error(`Error requesting ${url}`)
console.error(`Response message: \n${result}`)
LoggerInstance.error(`Error requesting ${url}`)
LoggerInstance.error(`Response message: \n${result}`)
throw result
}
return result
@ -66,10 +66,7 @@ export async function fetchMethod(url: string): Promise<AxiosResponse> {
export async function isValidProvider(url: string): Promise<boolean> {
try {
const response = await ProviderInstance.isValidProvider(
url,
fetchMethod(url)
)
const response = await ProviderInstance.isValidProvider(url, fetchMethod)
return response
} catch (error) {
console.error(`Error validating provider: ${error.message}`)