Last active
June 15, 2020 14:36
-
-
Save codrin-iftimie/1052f09244f40084488e471ff69cdc9d to your computer and use it in GitHub Desktop.
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
// Disclaimer: not actual code | |
// actions/login.js | |
import authService from "services/authService" | |
import {getLoginInfo} from "selectors/login" | |
export function login() { | |
return function thunk(dispatch, getState) { | |
const data = getLoginInfo(getState()); | |
if (!data.username) { | |
notifications.show({message: "Please enter an email"}) | |
} | |
dispatch({type: "LOGIN_LOADING", isLoading: true}); | |
await authService.login(data); | |
dispatch({type: "LOGIN_LOADING", isLoading: false}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment