Browse Source

Fix SelectCurrency return value

master
meriadec 7 years ago
parent
commit
5084a1f7cb
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 6
      src/components/SelectCurrency/index.js

6
src/components/SelectCurrency/index.js

@ -30,7 +30,9 @@ const mapStateToProps = (state, props: OwnProps) => ({
}) })
const SelectCurrency = ({ onChange, value, t, placeholder, currencies, ...props }: Props) => { const SelectCurrency = ({ onChange, value, t, placeholder, currencies, ...props }: Props) => {
const options = currencies ? currencies.map(c => ({ ...c, value: c.id, label: c.name })) : [] const options = currencies
? currencies.map(c => ({ ...c, value: c.id, label: c.name, currency: c }))
: []
return ( return (
<Select <Select
value={value} value={value}
@ -38,7 +40,7 @@ const SelectCurrency = ({ onChange, value, t, placeholder, currencies, ...props
renderValue={renderOption} renderValue={renderOption}
options={options} options={options}
placeholder={placeholder || t('common:selectCurrency')} placeholder={placeholder || t('common:selectCurrency')}
onChange={onChange} onChange={item => onChange(item ? item.currency : null)}
{...props} {...props}
/> />
) )

Loading…
Cancel
Save