Allow the creation of new entries

This commit is contained in:
Cássio Zen
2016-08-24 21:36:44 -03:00
parent fd79381160
commit b717874e7b
9 changed files with 73 additions and 29 deletions

View File

@ -1,6 +1,7 @@
import TestRepoBackend from './test-repo/implementation';
import GitHubBackend from './github/implementation';
import { resolveFormat } from '../formats/formats';
import { createEntry } from '../valueObjects/Entry';
class LocalStorageAuthStore {
storageKey = 'nf-cms-user';
@ -57,6 +58,11 @@ class Backend {
return this.implementation.entry(collection, slug).then(this.entryWithFormat(collection));
}
newEntry(collection) {
const newEntry = createEntry();
return this.entryWithFormat(collection)(newEntry);
}
entryWithFormat(collection) {
return (entry) => {
const format = resolveFormat(collection, entry);