From fb612d9ebfd13b32dd6680bdf1c149c66f56a62f Mon Sep 17 00:00:00 2001 From: Phil Leggetter Date: Tue, 20 Aug 2024 11:36:03 +0100 Subject: [PATCH] chore: handle errors on login/save profile and also persist profile --- pkg/login/client_login.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/login/client_login.go b/pkg/login/client_login.go index ccac6ef..00a2c5a 100644 --- a/pkg/login/client_login.go +++ b/pkg/login/client_login.go @@ -51,7 +51,12 @@ func Login(config *config.Config, input io.Reader) error { message := SuccessMessage(response.UserName, response.UserEmail, response.OrganizationName, response.TeamName, response.TeamMode == "console") ansi.StopSpinner(s, message, os.Stdout) - config.Profile.SaveProfile(config.LocalConfigFile != "") + if err = config.Profile.SaveProfile(false); err != nil { + return err + } + if err = config.Profile.UseProfile(); err != nil { + return err + } return nil }