Skip to content

Instantly share code, notes, and snippets.

@hedgerh
Created Jan 22, 2019
Embed
What would you like to do?
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)
})
}
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