Skip to content

Commit

Permalink
Adding default values
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalrymple committed Nov 28, 2017
1 parent 1567b66 commit 31a5576
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Models/BaseModel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const LinkParser = require('parse-link-header');

async function getAllPages(client, endpoint, options = {}, results = []) {
async function getAllPages(client, endpoint, options, results = []) {
const response = await client.get(endpoint, options, true);

if (!response.headers['x-page']) {
Expand All @@ -23,27 +23,27 @@ class BaseModel {
this.client = APIClient;
}

get(endpoint, options) {
get(endpoint, options = {}) {
if (!options.page) {
return getAllPages(this.client, endpoint, options);
}

return this.client.get(endpoint, options);
}

post(endpoint, options) {
post(endpoint, options = {}) {
return this.client.post(endpoint, options);
}

postForm(endpoint, options) {
postForm(endpoint, options = {}) {
return this.client.postForm(endpoint, options);
}

put(endpoint, options) {
put(endpoint, options = {}) {
return this.client.put(endpoint, options);
}

delete(endpoint, options) {
delete(endpoint, options = {}) {
return this.client.delete(endpoint, options);
}
}
Expand Down

0 comments on commit 31a5576

Please sign in to comment.