Skip to content

Commit

Permalink
Added new convo methods for ease of access to access tokens and lists
Browse files Browse the repository at this point in the history
  • Loading branch information
tmtek committed Oct 31, 2018
1 parent a23b551 commit 12aadf6
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 @@ -210,6 +210,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 (this._tmpContexts && this._tmpContexts[context]){
Expand Down Expand Up @@ -308,10 +319,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 12aadf6

Please sign in to comment.