[core] Fix default session behavior

This commit is contained in:
devlikepro committed 2024-09-16 12:59:51 +07:00
1 parent 6aa141bb33
commit 90f32638be
1 file changed
+6 -3
+6 -3
View File
@@ -255,7 +255,7 @@ export class SessionManagerCore extends SessionManager {
}
async getSessions(all: boolean): Promise<SessionInfo[]> {
if (this.session === null && all) {
if (this.session === DefaultSessionStatus.STOPPED && all) {
return [
{
name: this.DEFAULT,
@@ -265,12 +265,15 @@ export class SessionManagerCore extends SessionManager {
},
];
}
if (this.session === undefined && all) {
if (this.session === DefaultSessionStatus.REMOVED && all) {
return [];
}
if (!this.session && !all) {
return [];
}
const session = this.session as WhatsappSession;
const me = session.getSessionMeInfo();
const me = session?.getSessionMeInfo();
return [
{
name: session.name,