Refactor: use checkLoggedIn() instead of exitIfNotLoggedIn()

Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
Scott Lowe 2020-04-30 10:02:22 +02:00
parent 1d9a397f71
commit 153cdf4bb0
2 changed files with 2 additions and 18 deletions

View File

@ -91,7 +91,7 @@ export const logs: CommandDefinition<
'../utils/device/logs'
);
const { validateIPAddress } = await import('../utils/validation');
const { exitIfNotLoggedIn, exitWithExpectedError } = await import(
const { checkLoggedIn, exitWithExpectedError } = await import(
'../utils/patterns'
);
const Logger = await import('../utils/logger');
@ -152,7 +152,7 @@ export const logs: CommandDefinition<
servicesToDisplay,
);
} else {
await exitIfNotLoggedIn();
await checkLoggedIn();
if (options.tail) {
return balena.logs
.subscribe(params.uuidOrDevice, { count: 100 })

View File

@ -88,22 +88,6 @@ export async function checkLoggedIn(): Promise<void> {
}
}
/**
* Check if logged in, and call `exitWithExpectedError()` if not.
* DEPRECATED: Use checkLoggedIn() instead.
*/
export async function exitIfNotLoggedIn(): Promise<void> {
try {
await checkLoggedIn();
} catch (error) {
if (error instanceof NotLoggedInError) {
exitWithExpectedError(error);
} else {
throw error;
}
}
}
export function askLoginType() {
return getForm().ask<'web' | 'credentials' | 'token' | 'register'>({
message: 'How would you like to login?',