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
| handleLogInSubmit = () => { | |
| Auth.SignIn(email, password) | |
| .then((response) => { | |
| localStorage.setItem('isLogged', true) | |
| }) | |
| } |
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 PrivateRoute = ({component: Component, ...rest}) => { | |
| return( | |
| <Route {...rest} render={props => ( | |
| localStorage.getItem('isLogged') === 'true' ? | |
| <Component {...props} /> | |
| : <Redirect to="/login" /> | |
| )} | |
| /> | |
| ) | |
| } |
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
| signOut = () => { | |
| const { history } = this.props | |
| Auth.signOut() | |
| .then(() => { | |
| localStorage.clear() | |
| history.push('/login') | |
| }) | |
| .catch(err => console.log(err)) |
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
| <IdleTimer | |
| onIdle={this.onIdle} | |
| timeout={1000 * 60 * 30} | |
| /> | |
| onIdle = () => { | |
| alert("You have been idle for 30 minutes and have been logged out."); | |
| this.signOut(); | |
| } |
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
| // store/modules/base.js | |
| ... | |
| [SORT_TYPE]: (state, action) => { | |
| const {reportType, sortType, level} = action.payload | |
| ... | |
| return state.set('sortType', reportType + sortType + level) |
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
| onSortClick = (sortType) => { | |
| const {BaseActions} = this.props | |
| BaseActions.sortType({sortType, reportType: 'uniqueReportType', level: 'studentData'}) | |
| } | |
| ... | |
| render(){ | |
| const {onSortClick} = this |
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
| return ( | |
| <React.Fragment> | |
| <Table> | |
| <thead> | |
| <tr> | |
| <th onClick={() => handleSortClick("studentId")}> | |
| <strong> | |
| studentId | |
| {arrowToggle === -1 && sortType === "uniqueReportTypestudentIdstudentData" ? ( | |
| <>↓</> |
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
| // TableUI.js | |
| class TableUI extends Component{ | |
| handleSortClick = sortType => { | |
| const {onSortClick} = this.props; | |
| onSortClick(sortType) | |
| } | |
| render(){ |
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
| // SmartSort.js | |
| class SmartSort extends Component{ | |
| onSortClick = sortType => { | |
| const { BaseActions } = this.props; | |
| BaseActions.sortType({ sortType }) | |
| } | |
| } |
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
| // store/modules/base.js | |
| // initial state | |
| const initialState = Map({ | |
| mainData: List(... ), | |
| originalData: List(... ), | |
| arrowToggle: 0, | |
| sortType: "", | |
| sortToggle: false | |
| }); |