mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2026-02-05 06:46:27 -06:00
fix: Fixed error 500 when logout in instance with status = close
This commit is contained in:
@@ -401,6 +401,12 @@ export class InstanceController {
|
|||||||
|
|
||||||
public async logout({ instanceName }: InstanceDto) {
|
public async logout({ instanceName }: InstanceDto) {
|
||||||
this.logger.verbose('requested logout from ' + instanceName + ' instance');
|
this.logger.verbose('requested logout from ' + instanceName + ' instance');
|
||||||
|
const stateConn = await this.connectionState({ instanceName });
|
||||||
|
|
||||||
|
if (stateConn.state === 'close') {
|
||||||
|
throw new BadRequestException('Instance already logged out');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.logger.verbose('logging out instance: ' + instanceName);
|
this.logger.verbose('logging out instance: ' + instanceName);
|
||||||
await this.waMonitor.waInstances[instanceName]?.client?.logout(
|
await this.waMonitor.waInstances[instanceName]?.client?.logout(
|
||||||
|
|||||||
Reference in New Issue
Block a user