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

Attempt fix issue

This commit is contained in:
KY Lau 2021-06-09 18:39:50 +08:00
parent 0c1dea91b6
commit e3d916fe61
3 changed files with 14 additions and 8 deletions

View File

@ -27,18 +27,24 @@ export default function Credential(props: InputProps) {
helpers.setValue(newInput) helpers.setValue(newInput)
} }
function handleAddValue(e: FormEvent<HTMLButtonElement>) { function isCredentialValid(): boolean {
e.preventDefault()
if (!isAddress(value)) { if (!isAddress(value)) {
toast.error('Wallet address is invalid') toast.error('Wallet address is invalid')
return return false
} }
if (arrayInput.includes(value)) { if (arrayInput.includes(value)) {
toast.error('Wallet address already added into list') toast.error('Wallet address already added into list')
return return false
}
return true
}
function handleAddValue(e: FormEvent<HTMLButtonElement>) {
e.preventDefault()
if (isCredentialValid()) {
setArrayInput((arrayInput) => [...arrayInput, value])
setValue('')
} }
setArrayInput((arrayInput) => [...arrayInput, value])
setValue('')
} }
return ( return (

View File

@ -123,7 +123,7 @@ export default function EditAdvanceSettings({
{({ isSubmitting, values, initialValues }) => {({ isSubmitting, values, initialValues }) =>
isSubmitting || hasFeedback ? ( isSubmitting || hasFeedback ? (
<MetadataFeedback <MetadataFeedback
title="Updating Data Set" title="Updating Advance Settings"
error={error} error={error}
success={success} success={success}
setError={setError} setError={setError}

View File

@ -1,5 +1,5 @@
import React, { ChangeEvent, ReactElement } from 'react' import React, { ChangeEvent, ReactElement } from 'react'
import styles from './FormEditMetadata.module.css' // TODO import styles from './FormEditMetadata.module.css'
import { Field, Form, FormikContextType, useFormikContext } from 'formik' import { Field, Form, FormikContextType, useFormikContext } from 'formik'
import Button from '../../../atoms/Button' import Button from '../../../atoms/Button'
import Input from '../../../atoms/Input' import Input from '../../../atoms/Input'