Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10359898
current-session-subject.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1005 B
Referenced Files
None
Subscribers
None
current-session-subject.ts
View Options
import
{
LeafSubject
}
from
"../subject"
;
import
*
as
Errors
from
"../../response/errors"
;
import
Context
from
"../../context"
;
import
{
DeleteActionName
}
from
"../../action"
;
import
ItemList
from
"../../chip-types/item-list"
;
export
default
class
CurrentSession
extends
LeafSubject
{
async
performAction
(
context
:
Context
,
action_name
:
DeleteActionName
,
_
:
any
)
{
if
(
action_name
!==
"delete"
)
{
throw
new
Errors
.
DeveloperError
(
`Unknown action
${
action_name
}
for CurrentSession subject.`
);
}
try
{
const
sessions
=
await
new
ItemList
(
this
.
app
.
collections
.
sessions
,
new
this
.
app
.
SuperContext
()
)
.
filter
({
"session-id"
:
context
.
session_id
})
.
fetch
();
await
Promise
.
all
(
sessions
.
items
.
map
(
async
(
session
)
=>
session
.
remove
(
new
this
.
app
.
SuperContext
())
)
);
return
"You've been logged out"
;
}
catch
(
e
)
{
return
Promise
.
reject
(
new
Errors
.
BadContext
(
"Invalid session id!"
));
}
}
getName
()
{
return
"CurrentSession"
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Nov 8, 02:47 (16 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1033954
Default Alt Text
current-session-subject.ts (1005 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment