This file contains hidden or 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
... | |
class PostList extends Component { | |
async componentDidMount() { | |
const { fetchPostsAndData } = this.props; | |
await fetchPostsAndData(); | |
} | |
renderPosts = () => { | |
const postList = this.props.postList; |
This file contains hidden or 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
export const fetchPostsAndComments = () => async ( | |
dispatch, | |
getState | |
) => { | |
await dispatch(fetchPostList()); | |
const PostList = await getState().post.postList; | |
await PostList.forEach(post => { | |
dispatch(fetchPostComments(post._id)); | |
}); | |
}; |
This file contains hidden or 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
const timeRangeArr = []; | |
const lunchBreakFrom = moment() | |
.hours(12) | |
.minutes(0); | |
const lunchBreakTo = moment() | |
.hours(13) | |
.minutes(0); | |
const duration = 15; | |
for ( |
This file contains hidden or 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
const counter = 5; | |
[...Array(counter)].forEach( | |
(_, i) => { | |
console.log(i); | |
} | |
) |
This file contains hidden or 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
git branch -m old_branch new_branch | |
git push --set-upstream origin new_branch | |
git push origin :old_branch |
This file contains hidden or 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
class MyComponent extends Component { | |
componentDidUpdate() { | |
if (!!this.props.payload.success) { | |
this.props.actionCreator(); | |
this.props.history.push("/Dashboard"); | |
} | |
} | |
render() { | |
return ( |
This file contains hidden or 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
class MyComponent extends Component { | |
handleNewSubscription = () => { | |
this.props.actionCreator(); | |
return <Redirect to="/dashboard" />; | |
}; | |
render() { | |
!!this.props.payload.success ? this.handleNewSubscription() : null | |
return ( | |
... | |
) |
This file contains hidden or 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
class MyComponent extends Component { | |
render() { | |
if (!!this.props.payload.success) { | |
this.props.actionCreator(); | |
return <Redirect to="/dashboard" />; | |
} | |
return ( | |
... | |
) | |
} |
This file contains hidden or 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
export const handleProviderToken = token => async (dispatch, getState) => { | |
const testState = getState() | |
console.log(testState.auth); | |
dispatch({ type: TEST }); | |
}; |
This file contains hidden or 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
import { combineReducers } from "redux"; | |
import { reducer as reduxForm } from "redux-form"; | |
import authReducer from "./authReducer"; | |
export default combineReducers({ | |
auth: authReducer, | |
form: reduxForm | |
}); |