Skip to content

Commit

Permalink
Fix spinner mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcardeenas committed Apr 10, 2020
1 parent 5643071 commit c23e7b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/controllers/initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ export async function create(
}

// Initialize whatsapp
spinnies.add(`${session}`, { text: 'Creating whatsapp instace...' });
spinnies.add(`${session}-auth`, { text: 'Creating whatsapp instace...' });

const mergedOptions = { ...defaultOptions, ...options };
let waPage = await initWhatsapp(session, mergedOptions);

spinnies.update(`${session}`, { text: 'Authenticating...' });
spinnies.update(`${session}-auth`, { text: 'Authenticating...' });
const authenticated = await isAuthenticated(waPage);

// If not authenticated, show QR and wait for scan
if (authenticated) {
// Wait til inside chat
await isInsideChat(waPage).toPromise();
spinnies.succeed(`${session}-auth`, { text: 'Authenticated' });
} else {
spinnies.update(`${session}-auth`, {
Expand All @@ -58,7 +60,7 @@ export async function create(

// Wait til inside chat
await isInsideChat(waPage).toPromise();
spinnies.succeed(`${session}`, { text: 'Authenticated' });
spinnies.succeed(`${session}-auth`, { text: 'Authenticated' });
}

spinnies.add(`${session}-inject`, { text: 'Injecting api...' });
Expand Down

0 comments on commit c23e7b4

Please sign in to comment.