Unverified Commit bc39036e authored by Bradley Hilton's avatar Bradley Hilton
Browse files

Prettify the prompts and waitings

parent dfd63284
...@@ -18,15 +18,16 @@ export default class Login extends Command { ...@@ -18,15 +18,16 @@ export default class Login extends Command {
const cloudAuth = new CloudAuth(); const cloudAuth = new CloudAuth();
const hasToken = await cloudAuth.hasToken(); const hasToken = await cloudAuth.hasToken();
if (hasToken) { if (hasToken) {
cli.action.start(chalk.green('verifying') + ' your token...');
await cloudAuth.getToken(); await cloudAuth.getToken();
cli.log(chalk.green('you are already logged in!')); cli.action.stop(chalk.green('success, you are already logged in!'));
} else { } else {
try { try {
cli.log(chalk.green('*') + ' ' + chalk.gray('waiting for authorization...')); cli.action.start(chalk.green('waiting') + ' for authorization...');
await cloudAuth.executeAuthFlow(); await cloudAuth.executeAuthFlow();
cli.action.stop('success!'); cli.action.stop(chalk.green('success!'));
} catch (e) { } catch (e) {
cli.action.stop('failure to authenticate.'); cli.action.stop(chalk.red('failed to authenticate.'));
return; return;
} }
} }
......
...@@ -64,19 +64,6 @@ export default class Submit extends Command { ...@@ -64,19 +64,6 @@ export default class Submit extends Command {
//#endregion //#endregion
//#region asking for information //#region asking for information
/*
const result = await inquirer.prompt([{
type: 'input',
name: 'email',
message: 'What is the publisher\'s email address?',
validate: (answer: string) => {
const regex = /^[^@\s]+@[^@\s]+\.[^@\s]+$/g;
return regex.test(answer);
},
}]);
*/
const cloudAuth = new CloudAuth(); const cloudAuth = new CloudAuth();
const hasToken = await cloudAuth.hasToken(); const hasToken = await cloudAuth.hasToken();
let email = ''; let email = '';
...@@ -90,10 +77,11 @@ export default class Submit extends Command { ...@@ -90,10 +77,11 @@ export default class Submit extends Command {
if (cloudAccount.hasAccount) { if (cloudAccount.hasAccount) {
try { try {
cli.log(chalk.green('*') + ' ' + chalk.gray('waiting for authorization...')); cli.action.start(chalk.green('*') + ' ' + chalk.gray('waiting for authorization...'));
await cloudAuth.executeAuthFlow(); await cloudAuth.executeAuthFlow();
cli.action.stop(chalk.green('success!'));
} catch (e) { } catch (e) {
cli.action.stop('failure to authenticate.'); cli.action.stop(chalk.red('failed to authenticate.'));
return; return;
} }
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment