fix(whatsapp.gblib): Fixed check status.

This commit is contained in:
Rodrigo Rodriguez 2025-01-27 10:49:57 -03:00
parent fb5aeca78c
commit 8028c821cb
2 changed files with 8 additions and 2 deletions

View file

@ -243,14 +243,14 @@ export class NewUserDialog extends IGBDialog {
min, min,
botName, botName,
'999999999', '999999999',
'email@doman.cloud', 'email@domain.cloud',
'5521999998888', '5521999998888',
botName, botName,
null, null,
'12', '12',
'99', '99',
'1234', '1234',
'Starter.gbai', 'crawlergbot.gbai',
true true
); );

View file

@ -258,6 +258,9 @@ export class WhatsappDirectLine extends GBService {
return state === 'CONNECTED'; return state === 'CONNECTED';
default: default:
if (this.whatsappServiceUrl){
GBLog.verbose(`GBWhatsapp: Checking server...`); GBLog.verbose(`GBWhatsapp: Checking server...`);
let url = urlJoin(this.whatsappServiceUrl, 'status') + `?token=${this.min.instance.whatsappServiceKey}`; let url = urlJoin(this.whatsappServiceUrl, 'status') + `?token=${this.min.instance.whatsappServiceKey}`;
const options = { const options = {
@ -268,6 +271,9 @@ export class WhatsappDirectLine extends GBService {
const res = await fetch(url, options); const res = await fetch(url, options);
const json = await res.json(); const json = await res.json();
return json['accountStatus'] === 'authenticated'; return json['accountStatus'] === 'authenticated';
}
return true;
} }
} }