From 706381507711363ef98ab6da8c301bf3725d7773 Mon Sep 17 00:00:00 2001 From: Jimmy Lv Date: Sun, 25 Sep 2016 13:49:22 +0800 Subject: [PATCH] [#1] - Moved all actionTypes constants into small folder. --- src/constants/actionTypes.js | 6 ++++++ src/redux/reducers/article.js | 4 +--- src/redux/reducers/musicList.js | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/constants/actionTypes.js b/src/constants/actionTypes.js index 0987da7..ff4b2a1 100644 --- a/src/constants/actionTypes.js +++ b/src/constants/actionTypes.js @@ -1,5 +1,11 @@ export const TOGGLE_SIDEBAR: string = 'TOGGLE_SIDEBAR' export const TOGGLE_CONTENT: string = 'TOGGLE_CONTENT' +export const FETCH_MUSIC: string = 'FETCH_MUSIC' +export const FETCH_MUSIC_ERROR: string = 'FETCH_MUSIC_ERROR' + export const FETCH_ARTICLE_SUMMARY: string = 'FETCH_ARTICLE_SUMMARY' export const FETCH_ARTICLE_SUMMARY_ERROR: string = 'FETCH_ARTICLE_SUMMARY_ERROR' + +export const FETCH_ARTICLE: string = 'FETCH_ARTICLE' +export const FETCH_ARTICLE_ERROR: string = 'FETCH_ARTICLE_ERROR' diff --git a/src/redux/reducers/article.js b/src/redux/reducers/article.js index ac88224..dd19fb4 100644 --- a/src/redux/reducers/article.js +++ b/src/redux/reducers/article.js @@ -3,12 +3,10 @@ import jsyaml from 'js-yaml' import { ArticleType } from '../flow/types.x' import { API_URL } from '../../constants/' +import { FETCH_ARTICLE_ERROR, FETCH_ARTICLE } from '../../constants/actionTypes' import { hideLoading, showLoading } from 'react-redux-loading-bar' -const FETCH_ARTICLE: string = 'FETCH_ARTICLE' -const FETCH_ARTICLE_ERROR: string = 'FETCH_ARTICLE_ERROR' - const shouldFetchArticle = (state, id) => !(state.article.id && state.article.id === id) diff --git a/src/redux/reducers/musicList.js b/src/redux/reducers/musicList.js index fa707f0..24befb9 100644 --- a/src/redux/reducers/musicList.js +++ b/src/redux/reducers/musicList.js @@ -1,7 +1,6 @@ // @flow -const FETCH_MUSIC: string = 'FETCH_MUSIC' -const FETCH_MUSIC_ERROR: string = 'FETCH_MUSIC_ERROR' +import { FETCH_MUSIC, FETCH_MUSIC_ERROR } from '../../constants/actionTypes' export const fetchMusicList = () => dispatch => fetch('http://app.atime.me/music-api-server/?p=netease&t=playlist&i=389445274', { mode: 'no-cors' })