fix fetch params

This commit is contained in:
Cássio Zen 2016-07-19 17:29:40 -03:00
parent 1983ab4a1b
commit 39c575b52d

View File

@ -24,7 +24,7 @@ class API {
return this.request(`${this.repoURL}/contents/${path}`, { return this.request(`${this.repoURL}/contents/${path}`, {
headers: { Accept: 'application/vnd.github.VERSION.raw' }, headers: { Accept: 'application/vnd.github.VERSION.raw' },
data: { ref: this.branch }, body: { ref: this.branch },
cache: false cache: false
}).then((result) => { }).then((result) => {
if (sha) { if (sha) {
@ -38,7 +38,7 @@ class API {
listFiles(path) { listFiles(path) {
return this.request(`${this.repoURL}/contents/${path}`, { return this.request(`${this.repoURL}/contents/${path}`, {
data: { ref: this.branch } body: { ref: this.branch }
}); });
} }
@ -68,13 +68,13 @@ class API {
}) })
.then((changeTree) => { .then((changeTree) => {
return this.request(`${this.repoURL}/git/commits`, { return this.request(`${this.repoURL}/git/commits`, {
type: 'POST', method: 'POST',
data: JSON.stringify({ message: options.message, tree: changeTree.sha, parents: [changeTree.parentSha] }) body: JSON.stringify({ message: options.commitMessage, tree: changeTree.sha, parents: [changeTree.parentSha] })
}); });
}).then((response) => { }).then((response) => {
return this.request(`${this.repoURL}/git/refs/heads/${this.branch}`, { return this.request(`${this.repoURL}/git/refs/heads/${this.branch}`, {
type: 'PATCH', method: 'PATCH',
data: JSON.stringify({ sha: response.sha }) body: JSON.stringify({ sha: response.sha })
}); });
}); });
} }
@ -170,8 +170,8 @@ class API {
return Promise.all(updates) return Promise.all(updates)
.then((updates) => { .then((updates) => {
return this.request(`${this.repoURL}/git/trees`, { return this.request(`${this.repoURL}/git/trees`, {
type: 'POST', method: 'POST',
data: JSON.stringify({ base_tree: sha, tree: updates }) body: JSON.stringify({ base_tree: sha, tree: updates })
}); });
}).then((response) => { }).then((response) => {
return { path: path, mode: '040000', type: 'tree', sha: response.sha, parentSha: sha }; return { path: path, mode: '040000', type: 'tree', sha: response.sha, parentSha: sha };
@ -227,7 +227,7 @@ export default class GitHub {
)); ));
} }
persistEntry(collection, entry, mediaFiles = []) { persistEntry(collection, entry, mediaFiles = [], options = {}) {
return this.api.persistFiles(collection, entry, mediaFiles); return this.api.persistFiles(collection, entry, mediaFiles, options);
} }
} }