Created
January 22, 2019 16:52
-
-
Save hedgerh/79fa384b64eec95c37a3f278a39bb390 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
import httpClient from './httpClient' | |
const login = (email, password) => (dispatch) => { | |
return httpClient.login(email, password) | |
.then(response => { | |
httpClient.token = response.token | |
dispatch(loginSuccess(response)) | |
}) | |
} | |
const refreshToken = () => (dispatch) => { | |
httpClient.refreshToken() | |
.then(token => { | |
httpClient.token = token | |
dispatch(refreshTokenSuccess(token) | |
}) | |
} |
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
import HttpClient from './HttpClient' | |
// export an instance, aka a "Singleton", of HttpClient | |
export default new HttpClient() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment