MediaProxy upload

This commit is contained in:
Cássio Zen
2016-07-19 18:56:54 -03:00
parent 39c575b52d
commit 483fdb2643
3 changed files with 10 additions and 7 deletions

View File

@ -1,4 +1,5 @@
import { currentBackend } from '../backends/backend';
import { getMedia } from '../reducers';
/*
* Contant Declarations
@ -152,13 +153,15 @@ export function loadEntries(collection) {
};
}
export function persistEntry(collection, entry, mediaFiles) {
export function persistEntry(collection, entry) {
return (dispatch, getState) => {
const state = getState();
const backend = currentBackend(state.config);
const MediaProxies = entry.get('mediaFiles').map(path => getMedia(state, path));
dispatch(entryPersisting(collection, entry));
backend.persistEntry(collection, entry, mediaFiles).then(
({persistedEntry, persistedMediaFiles}) => {
backend.persistEntry(collection, entry, MediaProxies.toJS()).then(
({ persistedEntry, persistedMediaFiles }) => {
dispatch(entryPersisted(persistedEntry, persistedMediaFiles));
},
(error) => dispatch(entryPersistFail(collection, entry, error))