Skip to content

Commit

Permalink
Feat(Core) : Remove account from db and save new one (#3221)
Browse files Browse the repository at this point in the history
* removeAccountAndResave

* make operation async

---------

Co-authored-by: Connor Ivy <[email protected]>
  • Loading branch information
connorivy and Connor Ivy authored Mar 13, 2024
1 parent 9a3e689 commit ec1191f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Core/Core/Credentials/AccountManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public static string GetDefaultServerUrl()
/// Upgrades an account from the account.serverInfo.movedFrom account to the account.serverInfo.movedTo account
/// </summary>
/// <param name="id">Id of the account to upgrade</param>
public static void UpgradeAccount(string id)
public static async Task UpgradeAccount(string id)
{
var account =
GetAccounts().FirstOrDefault(acc => acc.id == id)
Expand All @@ -259,7 +259,9 @@ public static void UpgradeAccount(string id)
// setting the id to null will force it to be recreated
account.id = null;

s_accountStorage.UpdateObject(account.id!, JsonConvert.SerializeObject(account));
RemoveAccount(id);
s_accountStorage.SaveObject(account.id, JsonConvert.SerializeObject(account));
await s_accountStorage.WriteComplete().ConfigureAwait(false);
}

/// <summary>
Expand Down

0 comments on commit ec1191f

Please sign in to comment.