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

Add Category form for Edit. TODO : pass default values

parent 3f538894
Pipeline #30920 failed with stage
in 54 seconds
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { Confirm, Button, Header } from 'semantic-ui-react';
import { submit } from 'redux-form';
import CategoryForm from '../../forms/Category';
function CategoryEdit({ id, dispatch }) {
const handleFormSubmit = (values) => {
// Todo :
dispatch({ type: 'VALUES', payload: values });
};
export default function CategoryEdit({ id }) {
return (
<Confirm
open
cancelButton={<Button as={Link} to={`/categories/show/${id}`}>Retour</Button>}
confirmButton={<Button primary onClick={() => (dispatch(submit('category')))}> OK </Button>}
header={<Header as="h1">Éditer</Header>}
content={
<>
</>
}
<CategoryForm onSubmit={handleFormSubmit} />
}
/>
);
}
CategoryEdit.propTypes = {
id: PropTypes.number.isRequired,
dispatch: PropTypes.func.isRequired,
};
export default connect()(CategoryEdit);
......@@ -70,6 +70,8 @@ function Categories({
edit: (
<CategoryEdit
id={id}
name={name}
parentId={parentId}
/>
),
delete: (
......
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