connect((obj) => { return { login: obj.login, submitting: obj.loading.effects['login/login'], }; })
connect((state) => ( { isLoggedIn : state.login.isLoggedIn, counter : state.counter.counter, actions: state.base.actions } ), (dispatch) => ( { // the dispatch is provided by react-redux doServerCall: (actions) => { // it is used to put transport the action to actions.doServerCallWebSocket('counter') // the reducers, resulting in a change in the global state }, doActionCall: (actions) => { actions.doServerCallWebSocket('action') }}) )(App)
const Main = () => { const user = useSelector(state => state.login.user) return ( <View style={styles.container}> <Text style={styles.text}> This is the main page! Do what you will with this page going forwards! </Text> <Text style={styles.text}> Who knows maybe this will be a fancy menu or dashboard someday! {'\n'} </Text> <Text style={styles.italicText}>User Object: {JSON.stringify(user)}</Text> </View> ) }
withRouter(connect((state)=>({login: state.login}),null)(App))
export default function({ submit }) { const username = useForm("hello") const password = useForm() const dispatch = useDispatch() const errorMessage = useSelector(state => state.login.loginError) return ( <div className="container"> <h1>Please Login</h1> <Notification message={errorMessage} /> <form> <input type="text" placeholder="Enter Username" {...username} /> <input type="password" placeholder="Enter Password" {...password} /> <button onClick={e => { e.preventDefault() console.log( `username: ${username.value} || password: ${password.value}` ) // dispatch(login()) dispatch(loginFail()) }} > Login </button> </form> </div> ) }
connect( (state) => ({ loginInfo: state.login.loginInfo, actions: state.base.actions}), (dispatch) => ({ doLoginAction: (actions, loginInfo, username, password) => { doTryLogin(actions, loginInfo, username, password ); } }))(LoginView)
connect( state => { return state.login }, dispatch => (bindActionCreators({ recieveUsername, recievePassword, recieveRandom, loadServerRandom, changeLoginStatus, submitLoginRegiste }, dispatch)) )(Login)
connect((state) => ({ isLoggedIn: state.login.isLoggedIn, loginInfo: state.login.loginInfo, actions: state.base.actions}), (dispatch) => ({ doCheckLogin: (actions) => { doCheckLogin(actions) }, doLoginServerCall: (actions, loginInfo ) => { doTryLogin(actions,loginInfo, "kai", "sausages"); }, doLogoutServerCall: (actions, loginInfo) => { doLogout(actions,loginInfo); } }))(NavBar)
connect( (state) => { return { user: state.login.get("user"), }; }, (dispatch) => { return { logout: () => dispatch(logout()) }; } )(App)
connect( (state) => { return { error: state.login.get("error") }; }, (dispatch) => { return { signup: (payload) => { return dispatch(signup(payload)); } }; } )(Signup)
connect(store => store.login, null)(Admin)
connect((obj) => { return { login: obj.login, submitting: obj.loading.effects['login/login'], }; })
connect(store => store.login)(Reports)
connect(store => store.login)(Appeals)