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:
parent
6489a8d956
commit
cf0c31fc7b
@ -44,14 +44,14 @@ export default function FilesInput(props: InputProps): ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleClose() {
|
function handleClose() {
|
||||||
helpers.setValue(meta.initialValue)
|
|
||||||
helpers.setTouched(false)
|
helpers.setTouched(false)
|
||||||
|
helpers.setValue(meta.initialValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (field.name === 'links' && asset?.metadata?.links) {
|
if (field.name === 'links' && asset?.metadata?.links) {
|
||||||
handleValidation(null, asset.metadata.links[0])
|
handleValidation(null, asset.metadata.links[0])
|
||||||
} else if (field.name === 'files' && asset?.metadata?.links) {
|
} else if (field.name === 'files') {
|
||||||
getFileDidInfo(
|
getFileDidInfo(
|
||||||
asset?.id,
|
asset?.id,
|
||||||
asset?.services[0]?.id,
|
asset?.services[0]?.id,
|
||||||
@ -60,7 +60,12 @@ export default function FilesInput(props: InputProps): ReactElement {
|
|||||||
setHideUrl(true)
|
setHideUrl(true)
|
||||||
// setting placeholder for url file to avoid txs for the url file during initializing
|
// setting placeholder for url file to avoid txs for the url file during initializing
|
||||||
helpers.setValue([
|
helpers.setValue([
|
||||||
{ url: 'oceanprotocol.com/placeholder', ...fileDidInfo[0] }
|
{
|
||||||
|
url: fileDidInfo[0].valid
|
||||||
|
? 'http://oceanprotocol.com/placeholder'
|
||||||
|
: '',
|
||||||
|
...fileDidInfo[0]
|
||||||
|
}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ export function getInitialValues(
|
|||||||
name: metadata?.name,
|
name: metadata?.name,
|
||||||
description: metadata?.description,
|
description: metadata?.description,
|
||||||
price,
|
price,
|
||||||
links: metadata?.links as any,
|
links: [{ url: '', type: '' }],
|
||||||
files: [{ url: '', type: '' }],
|
files: [{ url: '', type: '' }],
|
||||||
timeout: secondsToString(timeout),
|
timeout: secondsToString(timeout),
|
||||||
author: metadata?.author,
|
author: metadata?.author,
|
||||||
|
@ -10,8 +10,8 @@ export const validationSchema = Yup.object().shape({
|
|||||||
files: Yup.array<FileInfo[]>()
|
files: Yup.array<FileInfo[]>()
|
||||||
.of(
|
.of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
url: Yup.string().url('Must be a valid URL.'),
|
url: Yup.string().url('Must be a valid URL.').required('Required'),
|
||||||
valid: Yup.boolean().isTrue()
|
valid: Yup.boolean().isTrue().required('File must be valid.')
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.nullable(),
|
.nullable(),
|
||||||
|
Loading…
Reference in New Issue
Block a user