Commit dbea25a2 authored by Rémy Huet's avatar Rémy Huet 💻

Ad form to create

parent e9d08265
Pipeline #30926 passed with stage
in 54 seconds
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { submit } from 'redux-form';
import { Link } from 'react-router-dom';
import { Confirm, Header, Button } from 'semantic-ui-react';
export default function CategoryCreate() {
import CategoryForm from '../../forms/Category';
function CategoryCreate({ dispatch }) {
const handleFormSubmit = (values) => {
// Todo
dispatch({ type: 'Category', payload: values });
};
return (
<Confirm
open
cancelButton={<Button as={Link} to="/categories">Retour</Button>}
confirmButton={<Button primary onClick={() => dispatch(submit('category'))}> OK </Button>}
header={<Header as="h1">Créer une catégorie</Header>}
content={<CategoryForm onSubmit={handleFormSubmit} />}
/>
);
}
CategoryCreate.propTypes = {
dispatch: PropTypes.func.isRequired,
};
export default connect()(CategoryCreate);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment