fix pressing enter on channel edit page for adding tags

This commit is contained in:
zxawry 2019-11-14 17:00:01 +00:00 committed by Sean Yesmunt
parent aa69b227bd
commit 66c6ec1626

View file

@ -1,6 +1,6 @@
// @flow
import React, { useState } from 'react';
import { Form, FormField } from 'component/common/form';
import { FormField } from 'component/common/form';
import Button from 'component/button';
import SelectAsset from 'component/selectAsset';
import TagsSelect from 'component/tagsSelect';
@ -98,15 +98,14 @@ function ChannelForm(props: Props) {
setParams({ ...params, coverUrl });
updateCover(coverUrl);
};
const handleSubmit = () => {
updateChannel(params);
setEditing(false);
};
// TODO clear and bail after submit
return (
<section className={'card--section'}>
<Form
onSubmit={() => {
updateChannel(params);
setEditing(false);
}}
>
<SelectAsset
onUpdate={v => handleThumbnailChange(v)}
currentValue={params.thumbnailUrl}
@ -198,10 +197,9 @@ function ChannelForm(props: Props) {
tagsChosen={params.tags || []}
/>
<div className={'card__actions'}>
<Button button="primary" label={__('Submit')} type="submit" />
<Button button="primary" label={__('Submit')} onClick={handleSubmit} />
<Button button="link" label={__('Cancel')} navigate={`$/${PAGES.CHANNELS}`} />
</div>
</Form>
</section>
);
}