refactor: Creating Medias reducer

This commit is contained in:
Cássio Zen
2016-06-10 00:16:01 -03:00
parent 9275aaec90
commit 1ba98fdb5a
21 changed files with 130 additions and 121 deletions

View File

@ -1,7 +1,7 @@
import yaml from 'js-yaml';
import { currentBackend } from '../backends/backend';
import { authenticate } from '../actions/auth';
import * as ImageProxy from '../valueObjects/ImageProxy';
import * as MediaProxy from '../valueObjects/MediaProxy';
export const CONFIG_REQUEST = 'CONFIG_REQUEST';
export const CONFIG_SUCCESS = 'CONFIG_SUCCESS';
@ -30,7 +30,7 @@ export function configFailed(err) {
export function configDidLoad(config) {
return (dispatch) => {
ImageProxy.setConfig(config);
MediaProxy.setConfig(config);
dispatch(configLoaded(config));
};
}

View File

@ -14,8 +14,7 @@ export const ENTRIES_FAILURE = 'ENTRIES_FAILURE';
export const DRAFT_CREATE = 'DRAFT_CREATE';
export const DRAFT_DISCARD = 'DRAFT_DISCARD';
export const DRAFT_CHANGE = 'DRAFT_CHANGE';
export const DRAFT_ADD_MEDIA = 'DRAFT_ADD_MEDIA';
export const DRAFT_REMOVE_MEDIA = 'DRAFT_REMOVE_MEDIA';
export const ENTRY_PERSIST_REQUEST = 'ENTRY_PERSIST_REQUEST';
export const ENTRY_PERSIST_SUCCESS = 'ENTRY_PERSIST_SUCCESS';
@ -125,20 +124,6 @@ export function changeDraft(entry) {
};
}
export function addMediaToDraft(mediaFile) {
return {
type: DRAFT_ADD_MEDIA,
payload: mediaFile
};
}
export function removeMediaFromDraft(mediaFile) {
return {
type: DRAFT_REMOVE_MEDIA,
payload: mediaFile
};
}
/*
* Exported Thunk Action Creators
*/

5
src/actions/media.js Normal file
View File

@ -0,0 +1,5 @@
export const ADD_MEDIA = 'ADD_MEDIA';
export function addMedia(file) {
return { type: ADD_MEDIA, payload: file };
}