mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
step3 validation
This commit is contained in:
parent
b61d1cc637
commit
3494e6195b
@ -49,7 +49,15 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
||||
}
|
||||
|
||||
public InputComponent = () => {
|
||||
const { type, options, group, name, required, onChange } = this.props
|
||||
const {
|
||||
type,
|
||||
options,
|
||||
group,
|
||||
name,
|
||||
required,
|
||||
onChange,
|
||||
value
|
||||
} = this.props
|
||||
|
||||
const wrapClass = this.inputWrapClasses()
|
||||
|
||||
@ -64,6 +72,7 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
||||
onFocus={this.toggleFocus}
|
||||
onBlur={this.toggleFocus}
|
||||
onChange={onChange}
|
||||
value={value}
|
||||
>
|
||||
<option value="">---</option>
|
||||
{options &&
|
||||
|
@ -73,6 +73,8 @@ class Publish extends Component<{}, PublishState> {
|
||||
private inputToArrayChange = (
|
||||
event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>
|
||||
) => {
|
||||
this.validateInputs(event.currentTarget.name, event.currentTarget.value)
|
||||
|
||||
this.setState({
|
||||
[event.currentTarget.name]: [event.currentTarget.value]
|
||||
})
|
||||
@ -145,6 +147,8 @@ class Publish extends Component<{}, PublishState> {
|
||||
//
|
||||
// Step 1
|
||||
//
|
||||
// TODO: also validate files with validationStatus[1].files here
|
||||
//
|
||||
if (validationStatus[1].name) {
|
||||
this.setState(prevState => ({
|
||||
validationStatus: {
|
||||
@ -157,12 +161,12 @@ class Publish extends Component<{}, PublishState> {
|
||||
}))
|
||||
}
|
||||
|
||||
console.log(validationStatus[1])
|
||||
// console.log(validationStatus[1])
|
||||
|
||||
//
|
||||
// Step 2
|
||||
//
|
||||
if (validationStatus[2].description) {
|
||||
if (validationStatus[2].description && validationStatus[2].categories) {
|
||||
this.setState(prevState => ({
|
||||
validationStatus: {
|
||||
...prevState.validationStatus,
|
||||
@ -174,9 +178,28 @@ class Publish extends Component<{}, PublishState> {
|
||||
}))
|
||||
}
|
||||
|
||||
console.log(validationStatus[2])
|
||||
// console.log(validationStatus[2])
|
||||
|
||||
//
|
||||
// Step 3
|
||||
//
|
||||
if (
|
||||
validationStatus[3].author &&
|
||||
validationStatus[3].copyrightHolder &&
|
||||
validationStatus[3].license
|
||||
) {
|
||||
this.setState(prevState => ({
|
||||
validationStatus: {
|
||||
...prevState.validationStatus,
|
||||
3: {
|
||||
...prevState.validationStatus[3],
|
||||
allFieldsValid: true
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
// console.log(validationStatus[3])
|
||||
}
|
||||
|
||||
private registerAsset = async (event: FormEvent<HTMLFormElement>) => {
|
||||
|
Loading…
Reference in New Issue
Block a user