mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-21 01:42:26 +00:00
Refactor: use checkLoggedIn() instead of exitIfNotLoggedIn()
Change-type: patch Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
parent
1d9a397f71
commit
153cdf4bb0
@ -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 })
|
||||
|
@ -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?',
|
||||
|
Loading…
x
Reference in New Issue
Block a user