factor out setLastSeenApp()
This commit is contained in:
parent
0116d817ef
commit
d5b9a23356
1 changed files with 20 additions and 17 deletions
|
|
@ -441,23 +441,7 @@ class Mediator {
|
||||||
|
|
||||||
this.socket.on(IS_GUN_AUTH, this.isGunAuth)
|
this.socket.on(IS_GUN_AUTH, this.isGunAuth)
|
||||||
|
|
||||||
this.socket.on(Action.SET_LAST_SEEN_APP, async body => {
|
this.socket.on(Action.SET_LAST_SEEN_APP, this.setLastSeenApp)
|
||||||
try {
|
|
||||||
await throwOnInvalidToken(body.token)
|
|
||||||
await API.Actions.setLastSeenApp()
|
|
||||||
this.socket.emit(Action.SET_LAST_SEEN_APP, {
|
|
||||||
ok: true,
|
|
||||||
msg: null,
|
|
||||||
origBody: body
|
|
||||||
})
|
|
||||||
} catch (e) {
|
|
||||||
this.socket.emit(Action.SET_LAST_SEEN_APP, {
|
|
||||||
ok: false,
|
|
||||||
msg: e.message,
|
|
||||||
origBody: body
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {SimpleSocket} socket */
|
/** @param {SimpleSocket} socket */
|
||||||
|
|
@ -543,6 +527,25 @@ class Mediator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param {{ token: string }} body */
|
||||||
|
setLastSeenApp = async body => {
|
||||||
|
try {
|
||||||
|
await throwOnInvalidToken(body.token)
|
||||||
|
await API.Actions.setLastSeenApp()
|
||||||
|
this.socket.emit(Action.SET_LAST_SEEN_APP, {
|
||||||
|
ok: true,
|
||||||
|
msg: null,
|
||||||
|
origBody: body
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
this.socket.emit(Action.SET_LAST_SEEN_APP, {
|
||||||
|
ok: false,
|
||||||
|
msg: e.message,
|
||||||
|
origBody: body
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isGunAuth = () => {
|
isGunAuth = () => {
|
||||||
try {
|
try {
|
||||||
const isGunAuth = isAuthenticated()
|
const isGunAuth = isAuthenticated()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue