import fetch from 'isomorphic-fetch';

import API from 'utils/api';
import { set_loading } from './loading';

export const QUOTE_RECEIVED = 'quote_received';

export function get_quote() {
  return function(dispatch) {
    dispatch(set_loading(true));
    return fetch(API.root + API.path.randomQuote)
      .then(response => response.json())
      .then((json) => {
        dispatch(set_loading(false));
        dispatch(quote_received(json));
      })
      .catch(() => {
        dispatch(set_loading(false));
      });
  }
}

export function quote_received(data) {
  return {
    type: QUOTE_RECEIVED,
    data
  }
}

export default function quote(state = {}, action) {
  switch(action.type) {
    case QUOTE_RECEIVED:
      return Object.assign({}, state, {value: action.data.quote, author: action.data.author});
    default:
      return state;
  }
}
@@ -150,16 +150,222 @@
 ceived';
+%0Aconst tempQuote = %7B%0A  quote: 'A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila.',%0A  author: 'Mitch Ratcliffe'%0A%7D;
 %0A%0Aexport
@@ -708,24 +708,69 @@
 ng(false));%0A
+        dispatch(quote_received(tempQuote));%0A
       %7D);%0A  
@@ -1095,13 +1095,14 @@
  state;%0A  %7D%0A
-
 %7D
+%0A

Add temp quote