refactor on slugformatter
This commit is contained in:
@ -86,8 +86,8 @@ class Backend {
|
||||
}
|
||||
|
||||
// We have the file path. Fetch and parse the file.
|
||||
getEntry(collection, slug, path) {
|
||||
return this.implementation.getEntry(collection, slug, path)
|
||||
getEntry(collection, slug) {
|
||||
return this.implementation.getEntry(collection, slug, new Collection(collection).entryPath(slug))
|
||||
.then(loadedEntry => this.entryWithFormat(collection, slug)(createEntry(
|
||||
collection.get('name'),
|
||||
slug,
|
||||
@ -97,10 +97,6 @@ class Backend {
|
||||
);
|
||||
}
|
||||
|
||||
lookupEntry(collection, slug) {
|
||||
return this.getEntry(collection, slug, new Collection(collection).entryPath(slug));
|
||||
}
|
||||
|
||||
newEntry(collection) {
|
||||
return createEntry(collection.get('name'));
|
||||
}
|
||||
@ -197,11 +193,11 @@ export function resolveBackend(config) {
|
||||
|
||||
switch (name) {
|
||||
case 'test-repo':
|
||||
return new Backend(new TestRepoBackend(config, slugFormatter), authStore);
|
||||
return new Backend(new TestRepoBackend(config), authStore);
|
||||
case 'github':
|
||||
return new Backend(new GitHubBackend(config, slugFormatter), authStore);
|
||||
return new Backend(new GitHubBackend(config), authStore);
|
||||
case 'netlify-git':
|
||||
return new Backend(new NetlifyGitBackend(config, slugFormatter), authStore);
|
||||
return new Backend(new NetlifyGitBackend(config), authStore);
|
||||
default:
|
||||
throw new Error(`Backend not found: ${ name }`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user