Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Алексей Левчук Lesson7 #64

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7fa03fc
Merge remote-tracking branch 'teacher/master' into lesson7
Headmaster11 Feb 10, 2019
0e6dfd4
working teacher example
Headmaster11 Feb 11, 2019
0219171
remove redundant file and code
Headmaster11 Feb 11, 2019
a3f8979
some renaming
Headmaster11 Feb 11, 2019
6fed832
better naming
Headmaster11 Feb 11, 2019
e10b980
better naming
Headmaster11 Feb 11, 2019
095a0e7
remove redundant props
Headmaster11 Feb 11, 2019
8725f18
forgot some files
Headmaster11 Feb 11, 2019
8e11e5f
refactoring
Headmaster11 Feb 11, 2019
ad891a6
remove warnings
Headmaster11 Feb 11, 2019
985d46f
remove redundant info from request
Headmaster11 Feb 11, 2019
aec470b
remove redundant info from fetch
Headmaster11 Feb 11, 2019
c390918
remove redundant code
Headmaster11 Feb 11, 2019
aa31af8
renaming
Headmaster11 Feb 11, 2019
904a13e
refactoring
Headmaster11 Feb 11, 2019
039462d
remove redundant code
Headmaster11 Feb 11, 2019
e16ecd4
simplify logic
Headmaster11 Feb 11, 2019
efd23e5
remove waiting for reponse check
Headmaster11 Feb 11, 2019
44546c4
remove unused variable
Headmaster11 Feb 11, 2019
72dba84
refactoring
Headmaster11 Feb 11, 2019
7367d2a
remake reducer
Headmaster11 Feb 11, 2019
811b0fa
moved to axios
Headmaster11 Feb 11, 2019
4d8e13b
refactoring
Headmaster11 Feb 11, 2019
5bd9a7d
refactor user component
Headmaster11 Feb 11, 2019
f661993
add layout
Headmaster11 Feb 12, 2019
8bd4a69
configuring router
Headmaster11 Feb 12, 2019
44fa0e2
rename app to users
Headmaster11 Feb 12, 2019
fd15f55
add styling for userlist
Headmaster11 Feb 12, 2019
bebb426
bring user to a separate entity
Headmaster11 Feb 12, 2019
460b9c1
refactoring
Headmaster11 Feb 12, 2019
2faa92a
add MenuItem
Headmaster11 Feb 12, 2019
03c897c
add Menu component
Headmaster11 Feb 12, 2019
8009ad8
enable to add user
Headmaster11 Feb 13, 2019
c3753e4
add new user on first place of the list
Headmaster11 Feb 13, 2019
d56a0a5
refactoring
Headmaster11 Feb 13, 2019
5f2b3ef
Merge branch 'master' of https://github.com/LeonEsquire/React-18.01 i…
Headmaster11 Feb 13, 2019
70ad004
refactor importing
Headmaster11 Feb 13, 2019
a13a2be
improve file names
Headmaster11 Feb 13, 2019
368adbb
rename reducer
Headmaster11 Feb 13, 2019
a8d3b43
remake dispatcher
Headmaster11 Feb 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion AliakseiLiauchuk/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
"presets": [
"@babel/preset-react",
"@babel/preset-env"
]
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
]
]
}
8 changes: 8 additions & 0 deletions AliakseiLiauchuk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
"popper.js": "^1.14.7",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-redux": "^6.0.0",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"redux": "^4.0.1",
"xmlhttprequest": "^1.8.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"axios": "^0.18.0",
Expand All @@ -23,6 +26,11 @@
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"node-sass": "^4.11.0",
"redux-devtools": "^3.5.0",
"redux-logger": "^3.0.6",
"redux-middleware": "^0.1.21",
"redux-promise-middleware": "^6.0.1",
"redux-thunk": "^2.3.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "^4.29.0",
Expand Down
31 changes: 0 additions & 31 deletions AliakseiLiauchuk/src/App.js

This file was deleted.

29 changes: 29 additions & 0 deletions AliakseiLiauchuk/src/actions/UserActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const RECEIVE_USERS = 'RECEIVE_USERS'
export const ADD_USER = 'ADD_USER'
import axios from 'axios'


export const getUsers = () => dispatch => {
return axios.get(`https://jsonplaceholder.typicode.com/users`)
.then(response => response.data)
.then(json => dispatch(
{
type: RECEIVE_USERS,
users: json,
}
))
}

export const addUser = () => dispatch => {
return dispatch(
{
type: ADD_USER,
user: {
username: "newUsername",
name: "newName",
email: "newEmail",
phone: "newPhone"
},
}
)
}
Copy link
Owner

@LeonEsquire LeonEsquire Feb 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export const RECEIVE_USERS = 'RECEIVE_USERS'
export const ADD_USER = 'ADD_USER'
import axios from 'axios'


export function fetchUsers() {
  return function(dispatch) {
    axios.get(`https://jsonplaceholder.typicode.com/users`)
    .then(response => dispatch({type: RECEIVE_USERS, payload: response.data}))
  }
}

// export const fetchUsers = () => dispatch => {
//   return axios.get(`https://jsonplaceholder.typicode.com/users`)
//     .then(response => response.data)
//     .then(json => dispatch(receiveUsers(json)))
// }

export function fetchUser(user) {
    return {type: ADD_USER, payload: user}
}

// export const fetchUser = () => (dispatch, getState) => {
//   const users = getState()
//   return dispatch(addUser(users))
// }

21 changes: 0 additions & 21 deletions AliakseiLiauchuk/src/app/actions/postActions.js

This file was deleted.

21 changes: 0 additions & 21 deletions AliakseiLiauchuk/src/app/actions/userActions.js

This file was deleted.

21 changes: 0 additions & 21 deletions AliakseiLiauchuk/src/app/components/PostItem.js

This file was deleted.

23 changes: 0 additions & 23 deletions AliakseiLiauchuk/src/app/components/PostsList.js

This file was deleted.

23 changes: 0 additions & 23 deletions AliakseiLiauchuk/src/app/components/User.js

This file was deleted.

21 changes: 0 additions & 21 deletions AliakseiLiauchuk/src/app/components/UsersList.js

This file was deleted.

2 changes: 0 additions & 2 deletions AliakseiLiauchuk/src/app/constants/postConstants.js

This file was deleted.

2 changes: 0 additions & 2 deletions AliakseiLiauchuk/src/app/constants/userConstants.js

This file was deleted.

2 changes: 0 additions & 2 deletions AliakseiLiauchuk/src/app/dispatcher.js

This file was deleted.

26 changes: 0 additions & 26 deletions AliakseiLiauchuk/src/app/pages/Post.js

This file was deleted.

45 changes: 0 additions & 45 deletions AliakseiLiauchuk/src/app/pages/Posts.js

This file was deleted.

26 changes: 0 additions & 26 deletions AliakseiLiauchuk/src/app/pages/User.js

This file was deleted.

Loading