-
Notifications
You must be signed in to change notification settings - Fork 0
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
Intégrer redux, react-redux, redux-saga pour l'authentification. (1/2) (#27) #28
Merged
Merged
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
46c4be2
modify prettierrc, ...
79df33d
refactor files' tree, ...
f2740e2
append user reducer, saga, ...
97d4655
append gradle configs, ...
a744c57
refactor configurations, ...
59d3106
append scenes, rework modules, ...
b538980
append routes, ...
61a2943
setup datas, ...
878d2c0
append render methods to modal, ...
5c096ec
remove extras props from render, ...
d7ac9e9
append sign-up, sign-in datas, ...
ce12c35
append extra props, move modal as dependencies, ...
69ee005
remove configs from build, ...
8cdbe7c
Merge branch 'features/6' of github.com:yungkittty/curb into features/27
18c50c8
merge with develop, ...
0f600e4
Merge branch 'develop' of github.com:yungkittty/curb into features/27
09ba426
fix button bind multiscenes
jimmydjabali 4a10698
Merge branch 'features/27' of https://github.com/yungkittty/curb into…
jimmydjabali 583a6a0
Scenes is rendered only when needed
jimmydjabali f86b8cf
changed default rightTo value
jimmydjabali ad043f5
fixed path -> pathname
jimmydjabali 0f46fde
append users reducers, actions creators, ...
ea26b9b
remove useless respond argument, ...
04422c7
Merge branch 'develop' of github.com:yungkittty/curb into features/27
2ffb504
fixed error
jimmydjabali 0da9b46
Update popup-window.js
jimmydjabali c087042
something, ...
c83a315
remove demo modifs, useless responds, ...
af44844
remove useless comments, ...
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { combineReducers } from "redux"; | ||
import { currentUserReducer as currentUser } from "../../datas/current-user"; | ||
import { usersReducer as users } from "../../datas/users"; | ||
|
||
const rootReducer = combineReducers({ /* ... */ }); | ||
const rootReducer = combineReducers({ currentUser, users }); | ||
|
||
export default rootReducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { all } from "redux-saga/effects"; | ||
import { signInSaga } from "../../datas/sign-in"; | ||
import { signUpSaga } from "../../datas/sign-up"; | ||
import { usersSaga } from "../../datas/users"; | ||
|
||
function* rootSaga() { yield all([ /* ... */ ]); } | ||
function* rootSaga() { yield all([signInSaga, signUpSaga, usersSaga]); } | ||
|
||
export default rootSaga; |
File renamed without changes.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import _ from "lodash"; | ||
import signInActionsTypes from "../sign-in/sign-in-actions-types"; | ||
|
||
const initialState = { id: "", token: "", refreshToken: "" }; | ||
|
||
const currentUserReducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
case signInActionsTypes.SIGN_IN_SUCCESS: | ||
return _.assign({}, state, action.payload); | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export default currentUserReducer; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import currentUserReducer from "./current-user-reducer"; | ||
|
||
// eslint-disable-next-line | ||
export { currentUserReducer }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import signInActionsTypes from "./sign-in-actions-types"; | ||
import signInActions from "./sign-in-actions"; | ||
import signInApi from "./sign-in-api"; | ||
import signInSaga from "./sign-in-saga"; | ||
|
||
export { signInActionsTypes, signInActions, signInApi, signInSaga }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const signInActionsTypes = { | ||
SIGN_IN_REQUEST: "SIGN_IN_REQUEST", | ||
SIGN_IN_SUCCESS: "SIGN_IN_SUCCESS", | ||
SIGN_IN_FAILURE: "SIGN_IN_FAILURE", | ||
SIGN_OUT_REQUEST: "SIGN_OUT_REQUEST", | ||
SIGN_OUT_SUCCESS: "SIGN_OUT_SUCCESS", | ||
SIGN_OUT_FAILURE: "SIGN_OUT_FAILURE" | ||
}; | ||
|
||
export default signInActionsTypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import signInActionsTypes from "./sign-in-actions-types"; | ||
|
||
const signInActions = { | ||
signInRequest: payload => ({ | ||
type: signInActionsTypes.SIGN_IN_REQUEST, | ||
payload | ||
}), | ||
signInSuccess: payload => ({ | ||
type: signInActionsTypes.SIGN_IN_SUCCESS, | ||
payload | ||
}), | ||
signInFailure: error => ({ | ||
type: signInActionsTypes.SIGN_IN_FAILURE, | ||
payload: error, | ||
error: true | ||
}), | ||
signOutRequest: payload => ({ | ||
type: signInActionsTypes.SIGN_OUT_REQUEST, | ||
payload | ||
}), | ||
signOutSuccess: () => ({ | ||
type: signInActionsTypes.SIGN_OUT_SUCCESS, | ||
payload: undefined | ||
}), | ||
signOutFailure: error => ({ | ||
type: signInActionsTypes.SIGN_OUT_FAILURE, | ||
payload: error, | ||
error: true | ||
}) | ||
}; | ||
|
||
export default signInActions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const signInApi = { signIn: () => ({}), signOut: () => ({}) }; | ||
|
||
export default signInApi; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { all, takeLatest, call, put } from "redux-saga/effects"; | ||
import usersActions from "../users/users-actions"; | ||
import signInActionsTypes from "./sign-in-actions-types"; | ||
import signInActions from "./sign-in-actions"; | ||
import signInApi from "./sign-in-api"; | ||
|
||
function* signInRequestSaga({ payload }) { | ||
try { | ||
const { id, ...others } = yield call(signInApi.signIn, payload); | ||
yield put(usersActions.getUserRequest({ id })); | ||
yield put(signInActions.signInSuccess({ id, ...others })); | ||
} catch (error) { | ||
yield put(signInActions.signInFailure(error)); | ||
} | ||
} | ||
|
||
function* signOutRequestSaga({ payload }) { | ||
try { | ||
yield call(signInApi.signOut, payload); | ||
yield put(signInActions.signOutSuccess()); | ||
} catch (error) { | ||
yield put(signInActions.signOutFailure(error)); | ||
} | ||
} | ||
|
||
const signInSaga = all([ | ||
takeLatest(signInActionsTypes.SIGN_IN_REQUEST, signInRequestSaga), | ||
takeLatest(signInActionsTypes.SIGN_OUT_REQUEST, signOutRequestSaga) | ||
]); | ||
|
||
export default signInSaga; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import signUpActionsTypes from "./sign-up-actions-types"; | ||
import signUpActions from "./sign-up-actions"; | ||
import signUpApi from "./sign-up-api"; | ||
import signUpSaga from "./sign-up-saga"; | ||
|
||
export { signUpActionsTypes, signUpActions, signUpApi, signUpSaga }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const signUpActionsTypes = { | ||
SIGN_UP_REQUEST: "SIGN_UP_REQUEST", | ||
SIGN_UP_SUCCESS: "SIGN_UP_SUCCESS", | ||
SIGN_UP_FAILURE: "SIGN_UP_FAILURE" | ||
}; | ||
|
||
export default signUpActionsTypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import signUpActionsTypes from "./sign-up-actions-types"; | ||
|
||
const signUpActions = { | ||
signUpRequest: payload => ({ | ||
type: signUpActionsTypes.SIGN_UP_REQUEST, | ||
payload | ||
}), | ||
signUpSuccess: () => ({ | ||
type: signUpActionsTypes.SIGN_UP_SUCCESS, | ||
payload: undefined | ||
}), | ||
signUpFailure: error => ({ | ||
type: signUpActionsTypes.SIGN_UP_FAILURE, | ||
payload: error, | ||
error: true | ||
}) | ||
}; | ||
|
||
export default signUpActions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const signUpApi = { signUp: () => ({}) }; | ||
|
||
export default signUpApi; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { all, takeLatest, call, put } from "redux-saga/effects"; | ||
import signInActions from "../sign-in/sign-in-actions"; | ||
import signUpActionsTypes from "./sign-up-actions-types"; | ||
import signUpActions from "./sign-up-actions"; | ||
import signUpApi from "./sign-up-api"; | ||
|
||
function* signUpRequestSaga({ payload }) { | ||
try { | ||
yield call(signUpApi.signUp, payload); | ||
yield put(signInActions.signInRequest(payload)); | ||
yield put(signUpActions.signUpSuccess()); | ||
} catch (error) { | ||
yield put(signUpActions.signUpFailure(error)); | ||
} | ||
} | ||
|
||
const signUpSaga = all([ | ||
takeLatest(signUpActionsTypes.SIGN_UP_REQUEST, signUpRequestSaga) | ||
]); | ||
|
||
export default signUpSaga; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import usersActionsTypes from "./users-actions-types"; | ||
import usersActions from "./users-actions"; | ||
import usersApi from "./users-api"; | ||
import usersReducer from "./users-reducer"; | ||
import usersSaga from "./users-saga"; | ||
|
||
export { usersActionsTypes, usersActions, usersApi, usersReducer, usersSaga }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const usersActionsTypes = { | ||
GET_USER_REQUEST: "GET_USER_REQUEST", | ||
GET_USER_SUCCESS: "GET_USER_SUCCESS", | ||
GET_USER_FAILURE: "GET_USER_FAILURE" | ||
}; | ||
|
||
export default usersActionsTypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import usersActionsTypes from "./users-actions-types"; | ||
|
||
const usersActions = { | ||
getUserRequest: payload => ({ | ||
type: usersActionsTypes.GET_USER_REQUEST, | ||
payload | ||
}), | ||
getUserSuccess: payload => ({ | ||
type: usersActionsTypes.GET_USER_SUCCESS, | ||
payload | ||
}), | ||
getUserFailure: error => ({ | ||
type: usersActionsTypes.GET_USER_FAILURE, | ||
payload: error, | ||
error: true | ||
}) | ||
}; | ||
|
||
export default usersActions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const usersApi = { getUser: () => ({}) }; | ||
|
||
export default usersApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import _ from "lodash"; | ||
import usersActionsTypes from "./users-actions-types"; | ||
|
||
const initialState = { byId: {}, allIds: [] }; | ||
|
||
const usersReducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
case usersActionsTypes.GET_USER_SUCCESS: | ||
return _.assign({}, state, { | ||
byId: _.assign({}, state.byId, { [action.payload.id]: action.payload }), | ||
allIds: _.concat([], state.allIds, [action.payload.id]) | ||
}); | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export default usersReducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { all, takeLatest, call, put } from "redux-saga/effects"; | ||
import usersActionsTypes from "./users-actions-types"; | ||
import usersActions from "./users-actions"; | ||
import usersApi from "./users-api"; | ||
|
||
function* getUsersRequestSaga({ payload }) { | ||
try { | ||
const respond = yield call(usersApi.getUser, payload); | ||
yield put(usersActions.getUserSuccess(respond)); | ||
} catch (error) { | ||
yield put(usersActions.getUserFailure(error)); | ||
} | ||
} | ||
|
||
const usersSaga = all([ | ||
takeLatest(usersActionsTypes.GET_USER_REQUEST, getUsersRequestSaga) | ||
]); | ||
|
||
export default usersSaga; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to remove