Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1262534
logout.redirect.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
872 B
Referenced Files
None
Subscribers
None
logout.redirect.ts
View Options
import
{
Context
}
from
"koa"
;
import
{
Mountable
}
from
"@sealcode/sealgen"
;
import
Router
from
"@koa/router"
;
export
const
actionName
=
"Logout"
;
export
default
new
(
class
LogoutRedirect
extends
Mountable
{
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async
canAccess
(
_
:
Context
)
{
return
{
canAccess
:
true
,
message
:
""
};
}
mount
(
router
:
Router
,
path
:
string
)
{
router
.
get
(
path
,
async
(
ctx
)
=>
{
console
.
log
(
"logout.redirect.ts:15"
);
try
{
const
session_id
=
ctx
.
cookies
.
get
(
"sealious-session"
);
if
(
session_id
)
{
await
ctx
.
$app
.
collections
.
sessions
.
logout
(
new
ctx
.
$app
.
SuperContext
(),
session_id
);
ctx
.
status
=
302
;
ctx
.
redirect
(
"/"
);
}
else
{
ctx
.
status
=
302
;
ctx
.
redirect
(
"/"
);
}
}
catch
(
error
)
{
console
.
error
(
"Error during logout:"
,
error
);
}
});
}
})();
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jan 24, 13:18 (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601599
Default Alt Text
logout.redirect.ts (872 B)
Attached To
Mode
rPHOTOAPP photo-app-demo
Attached
Detach File
Event Timeline
Log In to Comment