Commit 9e4212b9 authored by zarina's avatar zarina 🌊

рефактор кода

parent 1026abcd
......@@ -9,6 +9,7 @@ import Register from "./Register/Register";
import Login from "./Login/Login";
import AddProductForm from "./AddProductForm/AddProductForm";
import {logoutUser} from "../store/actions/usersActions";
import FullProduct from "./FullProduct/FullProduct";
class App extends Component {
......@@ -31,6 +32,7 @@ class App extends Component {
<Route path="/register" exact component={Register} />
<Route path="/login" exact component={Login} />
<Route path="/products/new" exact component={AddProductForm} />
<Route path="/products/:id" exact component={FullProduct} />
</Switch>
</Container>
</main>
......
......@@ -52,7 +52,7 @@ class Register extends Component {
label="Display name"
onChange={this.inputChangeHandler}
value={this.state.displayName}
required={false}
required={true}
type="text"
error={this.getFieldError("displayName")}
/>
......@@ -61,7 +61,7 @@ class Register extends Component {
label="Phone number"
onChange={this.inputChangeHandler}
value={this.state.phone}
required={false}
required={true}
type="text"
error={this.getFieldError("phone")}
/>
......
......@@ -61,7 +61,6 @@ export const createProduct = product => {
return (dispatch, getState) => {
const token = getState().users.user.token;
const headers = {Token: token};
console.log(product)
return axios.post("/products", product, {headers})
.then(() => {
dispatch(push('/'));
......@@ -78,7 +77,6 @@ export const deleteProduct = id => {
return (dispatch, getState) => {
const token = getState().users.user.token;
const headers = {Token: token};
console.log(headers)
axios.delete('/products/' + id, {headers})
.then(() => {
dispatch(push('/'));
......
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