Skip to content

Commit

Permalink
handle logout
Browse files Browse the repository at this point in the history
  • Loading branch information
JumanaFM committed Apr 15, 2021
1 parent 0dabb6f commit 33069ba
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -770,14 +770,16 @@ function embedNbApp () {
this.activeClass = newClass
},
onSessionEnd: async function () {
const token = localStorage.getItem("nb.user");
const config = { headers: { Authorization: 'Bearer ' + token }, params: { url: this.sourceURL } }
await axios.post(`/api/spotlights/log/session/end`, {
action: 'SESSION_END',
type: 'NONE',
class_id: this.activeClass.id,
role: this.user.role.toUpperCase()
}, config)
if (this.activeClass.id){
const token = localStorage.getItem("nb.user");
const config = { headers: { Authorization: 'Bearer ' + token }, params: { url: this.sourceURL } }
await axios.post(`/api/spotlights/log/session/end`, {
action: 'SESSION_END',
type: 'NONE',
class_id: this.activeClass.id,
role: this.user.role.toUpperCase()
}, config)
}
},
onLogout: async function () {
await this.onSessionEnd()
Expand Down

0 comments on commit 33069ba

Please sign in to comment.