Skip to content

Commit

Permalink
feat(GlpiRestClient): get full session
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianfranco97 authored and Hector Rondon committed Jan 17, 2018
1 parent e19ba14 commit 9dd5891
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/prepareRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ function prepareRequest (data) {
case 'addItem':
url = `${url}/${data.itemtype.name}`
myInit = {
method: 'POST',
method: 'GET',
body: JSON.stringify({input: data.input})
}
break

case 'getFullSession':
url = `${url}/getFullSession`
myInit = { method: 'GET'}
break

default:
break
}
Expand Down
18 changes: 18 additions & 0 deletions src/restclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@ class GlpiRestClient {
}
})
}

getFullSession () {
return new Promise((resolve, reject) => {
try {
const data = {
function: 'getFullSession'
}
this._makeRequest( prepareRequest(data), 'getFullSession', (promise) => {
promise.then(response => {
resolve ( response )
})
})
}
catch (err) {
reject(err)
}
})
}
}

export default GlpiRestClient

0 comments on commit 9dd5891

Please sign in to comment.