From 7ef59901e08b6610f134c696876695cf52061f48 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 17 Sep 2018 01:57:44 +0200 Subject: redirection --- app/client/auth/auth.actions.js | 6 +++--- app/client/auth/auth.gate.js | 4 ++-- app/client/auth/login.component.js | 2 +- app/client/auth/signup.component.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'app/client') diff --git a/app/client/auth/auth.actions.js b/app/client/auth/auth.actions.js index 3171996..8d9a819 100644 --- a/app/client/auth/auth.actions.js +++ b/app/client/auth/auth.actions.js @@ -45,7 +45,8 @@ export function login(username, password) { .then(req => req.json()) .then(data => { console.log(data) - dispatch(setToken(data.token)) + dispatch(setCurrentUser(data)) + // dispatch(setToken(data.token)) dispatch(checkin()) }) .catch(error => { @@ -71,7 +72,7 @@ export function signup(data) { } } -export function checkin(history) { +export function checkin() { return (dispatch) => { dispatch(loading()) fetch(api.checkin, put({})) @@ -83,7 +84,6 @@ export function checkin(history) { }) .catch(error => { console.log(error) - // history.go('/login') dispatch(initialized(true)) }) } diff --git a/app/client/auth/auth.gate.js b/app/client/auth/auth.gate.js index 8bedfa9..4890864 100644 --- a/app/client/auth/auth.gate.js +++ b/app/client/auth/auth.gate.js @@ -23,8 +23,8 @@ class AuthRouter extends Component { - { - props.actions.setReturnTo(props.location.pathname) + { + this.props.actions.setReturnTo(props.location.pathname) return ( ) diff --git a/app/client/auth/login.component.js b/app/client/auth/login.component.js index d2b7145..3cfcb78 100644 --- a/app/client/auth/login.component.js +++ b/app/client/auth/login.component.js @@ -31,7 +31,7 @@ class Login extends Component { } render(){ if (this.props.auth.isAuthenticated) { - return + return } return (
diff --git a/app/client/auth/signup.component.js b/app/client/auth/signup.component.js index 6f9cdaf..87e6ac6 100644 --- a/app/client/auth/signup.component.js +++ b/app/client/auth/signup.component.js @@ -39,7 +39,7 @@ class Signup extends Component { } render(){ if (this.props.auth.isAuthenticated) { - return + return } return ( -- cgit v1.2.3-70-g09d2