Revert "Greet the user after login with a toast"
This reverts commit b85ce62b
This commit is contained in:
parent
bf8a9431bf
commit
f243b69a5e
15
js/api.js
15
js/api.js
|
|
@ -20,7 +20,6 @@ const actiontypes_userinfo = {
|
||||||
'LOGIN' : 'LOGIN',
|
'LOGIN' : 'LOGIN',
|
||||||
'LOGIN_RESULT_SUCCESS' : 'LOGIN_RESULT_SUCCESS',
|
'LOGIN_RESULT_SUCCESS' : 'LOGIN_RESULT_SUCCESS',
|
||||||
'LOGIN_RESULT_ERROR' : 'LOGIN_RESULT_ERROR',
|
'LOGIN_RESULT_ERROR' : 'LOGIN_RESULT_ERROR',
|
||||||
'GREET' : 'GREET',
|
|
||||||
|
|
||||||
'CLEAR_ERRORS' : 'CLEAR_ERRORS',
|
'CLEAR_ERRORS' : 'CLEAR_ERRORS',
|
||||||
|
|
||||||
|
|
@ -38,7 +37,6 @@ const actiontypes_userinfo = {
|
||||||
|
|
||||||
const defaultstate_userinfo = {
|
const defaultstate_userinfo = {
|
||||||
isSignedIn : false,
|
isSignedIn : false,
|
||||||
wasGreeted : false,
|
|
||||||
username : null,
|
username : null,
|
||||||
error : false,
|
error : false,
|
||||||
errorMessages : [],
|
errorMessages : [],
|
||||||
|
|
@ -216,7 +214,6 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
|
||||||
case actiontypes_userinfo.LOGIN_RESULT_SUCCESS:
|
case actiontypes_userinfo.LOGIN_RESULT_SUCCESS:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
isSignedIn : true,
|
isSignedIn : true,
|
||||||
wasGreeted : false,
|
|
||||||
error : false,
|
error : false,
|
||||||
errorMessages : [],
|
errorMessages : [],
|
||||||
username : action.parameters.username,
|
username : action.parameters.username,
|
||||||
|
|
@ -238,10 +235,6 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
|
||||||
__store.dispatch({ type : actiontypes_userinfo.CLEAR });
|
__store.dispatch({ type : actiontypes_userinfo.CLEAR });
|
||||||
});
|
});
|
||||||
return Object.assign({}, state, {});
|
return Object.assign({}, state, {});
|
||||||
case actiontypes_userinfo.GREET:
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
wasGreeted : true,
|
|
||||||
});
|
|
||||||
case actiontypes_userinfo.STORE_AUTH_HEADERS:
|
case actiontypes_userinfo.STORE_AUTH_HEADERS:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
accesstoken : action.parameters.accesstoken,
|
accesstoken : action.parameters.accesstoken,
|
||||||
|
|
@ -403,14 +396,6 @@ export function login(email, password) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function greet() {
|
|
||||||
__store.dispatch({
|
|
||||||
type: actiontypes_userinfo.GREET,
|
|
||||||
parameters: {},
|
|
||||||
state: __store.getState()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function logout() {
|
export function logout() {
|
||||||
__store.dispatch({
|
__store.dispatch({
|
||||||
type : actiontypes_userinfo.LOGOUT,
|
type : actiontypes_userinfo.LOGOUT,
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@ import {
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import {greet, logout} from '../api';
|
import { logout } from '../api';
|
||||||
import {notify} from "react-notify-toast";
|
|
||||||
|
|
||||||
export class TurniereNavigation extends React.Component {
|
export class TurniereNavigation extends React.Component {
|
||||||
|
|
||||||
|
|
@ -68,12 +67,7 @@ function Betabadge() {
|
||||||
class InvisibleLoginLogoutButtons extends React.Component {
|
class InvisibleLoginLogoutButtons extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {isSignedIn, username, wasGreeted} = this.props;
|
const { isSignedIn, username } = this.props;
|
||||||
|
|
||||||
if (isSignedIn && !wasGreeted) {
|
|
||||||
notify.show('Willkommen, ' + username + '!', 'success', 3000);
|
|
||||||
greet();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isSignedIn) {
|
if(isSignedIn) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -94,8 +88,8 @@ class InvisibleLoginLogoutButtons extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToLoginLogoutButtonProperties = (state) => {
|
const mapStateToLoginLogoutButtonProperties = (state) => {
|
||||||
const {isSignedIn, username, wasGreeted} = state.userinfo;
|
const { isSignedIn, username } = state.userinfo;
|
||||||
return {isSignedIn, username, wasGreeted};
|
return { isSignedIn, username };
|
||||||
};
|
};
|
||||||
|
|
||||||
const LoginLogoutButtons = connect(
|
const LoginLogoutButtons = connect(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue