mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: logout error when not logged in
This commit is contained in:
@@ -345,6 +345,8 @@ export const makeSocket = ({
|
|||||||
)
|
)
|
||||||
/** logout & invalidate connection */
|
/** logout & invalidate connection */
|
||||||
const logout = async() => {
|
const logout = async() => {
|
||||||
|
const jid = authState.creds.me?.id
|
||||||
|
if(jid) {
|
||||||
await sendNode({
|
await sendNode({
|
||||||
tag: 'iq',
|
tag: 'iq',
|
||||||
attrs: {
|
attrs: {
|
||||||
@@ -357,12 +359,14 @@ export const makeSocket = ({
|
|||||||
{
|
{
|
||||||
tag: 'remove-companion-device',
|
tag: 'remove-companion-device',
|
||||||
attrs: {
|
attrs: {
|
||||||
jid: authState.creds.me!.id,
|
jid: jid,
|
||||||
reason: 'user_initiated'
|
reason: 'user_initiated'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
end(new Boom('Intentional Logout', { statusCode: DisconnectReason.loggedOut }))
|
end(new Boom('Intentional Logout', { statusCode: DisconnectReason.loggedOut }))
|
||||||
}
|
}
|
||||||
/** Waits for the connection to WA to reach a state */
|
/** Waits for the connection to WA to reach a state */
|
||||||
|
|||||||
Reference in New Issue
Block a user