mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 12:39:20 +00:00
feat(example): better sesion data save (#79)
For more consistency whenever I have a successful authentication I write to the json file the session data
This commit is contained in:
@@ -20,14 +20,12 @@ client.on('qr', (qr) => {
|
|||||||
|
|
||||||
client.on('authenticated', (session) => {
|
client.on('authenticated', (session) => {
|
||||||
console.log('AUTHENTICATED', session);
|
console.log('AUTHENTICATED', session);
|
||||||
|
sessionCfg=session;
|
||||||
if (!fs.existsSync(SESSION_FILE_PATH)) {
|
|
||||||
fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) {
|
fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('auth_failure', msg => {
|
client.on('auth_failure', msg => {
|
||||||
|
|||||||
Reference in New Issue
Block a user