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

fix submit button disabled

This commit is contained in:
EnzoVezzaro 2022-10-13 09:30:45 -04:00
parent 6489a8d956
commit cf0c31fc7b
3 changed files with 11 additions and 6 deletions

View File

@ -44,14 +44,14 @@ export default function FilesInput(props: InputProps): ReactElement {
}
function handleClose() {
helpers.setValue(meta.initialValue)
helpers.setTouched(false)
helpers.setValue(meta.initialValue)
}
useEffect(() => {
if (field.name === 'links' && asset?.metadata?.links) {
handleValidation(null, asset.metadata.links[0])
} else if (field.name === 'files' && asset?.metadata?.links) {
} else if (field.name === 'files') {
getFileDidInfo(
asset?.id,
asset?.services[0]?.id,
@ -60,7 +60,12 @@ export default function FilesInput(props: InputProps): ReactElement {
setHideUrl(true)
// setting placeholder for url file to avoid txs for the url file during initializing
helpers.setValue([
{ url: 'oceanprotocol.com/placeholder', ...fileDidInfo[0] }
{
url: fileDidInfo[0].valid
? 'http://oceanprotocol.com/placeholder'
: '',
...fileDidInfo[0]
}
])
})
}

View File

@ -11,7 +11,7 @@ export function getInitialValues(
name: metadata?.name,
description: metadata?.description,
price,
links: metadata?.links as any,
links: [{ url: '', type: '' }],
files: [{ url: '', type: '' }],
timeout: secondsToString(timeout),
author: metadata?.author,

View File

@ -10,8 +10,8 @@ export const validationSchema = Yup.object().shape({
files: Yup.array<FileInfo[]>()
.of(
Yup.object().shape({
url: Yup.string().url('Must be a valid URL.'),
valid: Yup.boolean().isTrue()
url: Yup.string().url('Must be a valid URL.').required('Required'),
valid: Yup.boolean().isTrue().required('File must be valid.')
})
)
.nullable(),