Skip to content

Commit

Permalink
Adds query template.
Browse files Browse the repository at this point in the history
  • Loading branch information
coco98 committed Jun 23, 2017
1 parent d4c81a6 commit fe98cc0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Data.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,25 @@ class Data {
});
}

queryTemplateAsRole(role, template, params, onSuccess, onError = defaultExceptionHandler) {
this.queryTemplate(template, params, onSuccess, onError, role);
}

queryTemplate(template, params, onSuccess, onError = defaultExceptionHandler, role = null) {
// TODO
const opts = {service: 'data', path: '/v1/template/' + template, json: params};
if (role) {
opts.role = role;
}

this.hasura.fetch(
opts,
(result) => {
onSuccess(result);
},
(e) => {
logError(e);
onError(e);
});
}
}

Expand Down

0 comments on commit fe98cc0

Please sign in to comment.