Skip to content

Commit 01d4a95

Browse files
committed
fix: Fixed error 500 when logout in instance with status = close
1 parent bb44903 commit 01d4a95

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/whatsapp/controllers/instance.controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,12 @@ export class InstanceController {
401401

402402
public async logout({ instanceName }: InstanceDto) {
403403
this.logger.verbose('requested logout from ' + instanceName + ' instance');
404+
const stateConn = await this.connectionState({ instanceName });
405+
406+
if (stateConn.state === 'close') {
407+
throw new BadRequestException('Instance already logged out');
408+
}
409+
404410
try {
405411
this.logger.verbose('logging out instance: ' + instanceName);
406412
await this.waMonitor.waInstances[instanceName]?.client?.logout(

0 commit comments

Comments
 (0)