Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
exam_11_front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zarina
exam_11_front
Commits
9e4212b9
Commit
9e4212b9
authored
Jul 30, 2020
by
zarina
🌊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
рефактор кода
parent
1026abcd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
App.js
src/containers/App.js
+2
-0
Register.js
src/containers/Register/Register.js
+2
-2
productsActions.js
src/store/actions/productsActions.js
+0
-2
No files found.
src/containers/App.js
View file @
9e4212b9
...
...
@@ -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
>
...
...
src/containers/Register/Register.js
View file @
9e4212b9
...
...
@@ -52,7 +52,7 @@ class Register extends Component {
label
=
"Display name"
onChange
=
{
this
.
inputChangeHandler
}
value
=
{
this
.
state
.
displayName
}
required
=
{
fals
e
}
required
=
{
tru
e
}
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
=
{
fals
e
}
required
=
{
tru
e
}
type
=
"text"
error
=
{
this
.
getFieldError
(
"phone"
)}
/
>
...
...
src/store/actions/productsActions.js
View file @
9e4212b9
...
...
@@ -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
(
'/'
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment