Skip to content

Commit

Permalink
Merge branch 'feature/convo_methods' into feature/unit_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmtek committed Nov 1, 2018
2 parents aae0659 + 12aadf6 commit fbb0cd5
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/convo.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ class Convo {
return this;
}

getAccessToken() {
if (this.conv && this.conv.user && this.conv.user.access && this.conv.user.access.token) {
return this.conv.user.access.token;
}
return null;
}

hasAccessToken() {
return this.getAccessToken() !== null;
}

getContext(context) {
if (!context) {
throw new Error('You must provide a context to getContext()');
Expand Down Expand Up @@ -316,10 +327,17 @@ class Convo {
return this;
}

hasList() {
hasList(type = null) {
if (type && this.hasList()) {
return type === this.getContext('list').type;
}
return this.getContext('list') && this.getContext('list').list;
}

getList() {
return this.getContext('list');
}

updateListPaging(paging = { start: 0, count: -1 }){
if (this.hasList()){
let listContext = this.getContext('list');
Expand Down

0 comments on commit fbb0cd5

Please sign in to comment.