/*
 * boilerplate-redux-react
 *
 * Copyright(c) 2015 André König <andre.koenig@posteo.de>
 * MIT Licensed
 *
 */

/**
 * @author André König <andre.koenig@posteo.de>
 *
 */

import {handleActions} from 'redux-actions';

import Actions from '../actions';

const {RANDOMIZE} = Actions.greeting;

const GREETINS = [
    'Servus',
    'Hello',
    'Hallo',
    'Guten Tag',
    'Hey',
    'S\'up?',
    'Moin',
    'Moin Moin'
];

function getRandomGreeting () {
    return GREETINS[Math.floor(Math.random() * 1000) % GREETINS.length];
}

function createState () {
    return getRandomGreeting();
}

export default handleActions({
    [RANDOMIZE]: (state, action) => {
        return getRandomGreeting()
    }
}, createState());

@@ -301,16 +301,17 @@
  GREETIN
+G
 S = %5B%0A  
@@ -472,16 +472,17 @@
  GREETIN
+G
 S%5BMath.f
@@ -517,16 +517,17 @@
  GREETIN
+G
 S.length

Fix typo