diff --git a/client/src/routes/Details/AssetDetails.tsx b/client/src/routes/Details/AssetDetails.tsx index 16d51f7..16ced8d 100644 --- a/client/src/routes/Details/AssetDetails.tsx +++ b/client/src/routes/Details/AssetDetails.tsx @@ -24,7 +24,7 @@ interface AssetDetailsState { dateCreated?: string description?: string copyrightHolder?: string - categories?: string + categories?: string[] } export default class AssetDetails extends PureComponent< @@ -49,6 +49,14 @@ export default class AssetDetails extends PureComponent< }) } + private inputToArrayChange = ( + event: ChangeEvent | ChangeEvent + ) => { + this.setState({ + [event.currentTarget.name]: [event.currentTarget.value] + }) + } + private toggleEditMode = () => { this.setState({ isEditMode: !this.state.isEditMode }) } @@ -166,15 +174,15 @@ export default class AssetDetails extends PureComponent< placeholder={steps[1].fields.categories.placeholder} required={steps[1].fields.categories.required} type={steps[1].fields.categories.type} - onChange={this.inputChange} + onChange={this.inputToArrayChange} options={steps[1].fields.categories.options} - value={value} + value={value[0]} disabled={this.state.isLoading} small /> ) : ( // TODO: Make this link to search for respective category - {value} + {value[0]} ) private Description = ({ value }: { value: string }) =>