Skip to content

Instantly share code, notes, and snippets.

@jean-leonco
Created February 19, 2020 15:53
Show Gist options
  • Save jean-leonco/615ba4caba4b6d9a5e2b3916200d81a9 to your computer and use it in GitHub Desktop.
Save jean-leonco/615ba4caba4b6d9a5e2b3916200d81a9 to your computer and use it in GitHub Desktop.
// 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