Created
February 19, 2020 15:53
-
-
Save jean-leonco/615ba4caba4b6d9a5e2b3916200d81a9 to your computer and use it in GitHub Desktop.
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
// History | |
import { createBrowserHistory } from 'history'; | |
const history = createBrowserHistory(); | |
export default history; | |
// App | |
import React from 'react'; | |
import { Router } from 'react-router-dom'; | |
function App() { | |
return ( | |
<Router history={history}> | |
<Routes /> | |
</Router> | |
); | |
} | |
export default App; | |
// Saga | |
export function* signIn({ payload }) { | |
const response = yield call(api.post, 'sessions', { | |
email: payload.email, | |
password: payload.password, | |
}); | |
const { token, user } = response.data; | |
yield put(signInSuccess(token, user)); | |
history.push('/dashboard'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment