Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Commit

Permalink
Add direction support
Browse files Browse the repository at this point in the history
  • Loading branch information
rogaldh committed Jun 18, 2019
1 parent f580fc2 commit 4aa7bc5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/events",
"version": "0.1.1",
"version": "0.1.2",
"description": "JavaScript API-client for uLMS Events service",
"files": [
"es",
Expand Down
12 changes: 9 additions & 3 deletions src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ export class HttpEventsResource {
}
}
getState (audience, roomId, params = {}) {
const { offset } = params
let qs = ''
const { offset, direction } = params
const qsParts = []

if (!isNaN(offset)) {
qs = `?offset=${offset}`
qsParts.push(`offset=${offset}`)
}

if (~['forward', 'backward'].indexOf(direction)) {
qsParts.push(`direction=${direction}`)
}

const qs = qsParts.length ? `?${qsParts.join('&')}` : ''

return this.tokenProvider.getToken()
.then((token) =>
this.httpClient.get(
Expand Down

0 comments on commit 4aa7bc5

Please sign in to comment.