Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit f8ca296

Browse files
committed
fix: await for settings
1 parent bc9de50 commit f8ca296

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/commands/delegations/list.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ import { buildSimpleConsoleTable } from '../../utils.js'
1717
const handler = async ({ profile }) => {
1818
const client = getClient(profile)
1919
const id = await client.account()
20-
const selected = client.settings.get('delegation')
21-
const delegations = client.settings.get('delegations')
20+
const settings = await client.settings
21+
const selected = settings.get('delegation')
22+
const delegations = settings.get('delegations')
2223

2324
const table = buildSimpleConsoleTable(['selected', 'alias', 'did'])
2425
for (const [did, del] of Object.entries(delegations)) {

src/commands/delegations/switch.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import listAccounts from './list.js'
1818
*/
1919
const handler = async ({ did, alias, profile }) => {
2020
const client = getClient(profile)
21-
const delegations = client.settings.get('delegations')
21+
const settings = await client.settings
22+
const delegations = settings.get('delegations')
2223
if (!delegations) {
2324
console.log('No delegations.')
2425
return
@@ -38,7 +39,7 @@ const handler = async ({ did, alias, profile }) => {
3839
const found = choices.find((x) => x.alias == alias)
3940
if (found) {
4041
const del = found.value
41-
client.settings.set('delegation', del)
42+
settings.set('delegation', del)
4243
console.log(`now using account: ${del}`)
4344
} else {
4445
console.log(
@@ -59,18 +60,19 @@ const handler = async ({ did, alias, profile }) => {
5960
* @param {any} client
6061
*/
6162
async function inquirerPick(choices, client) {
63+
const settings = await client.settings
6264
await inquirer
6365
.prompt([
6466
{
6567
type: 'list',
6668
name: 'Choose an account',
6769
choices,
68-
default: client.settings.get('delegation'),
70+
default: settings.get('delegation'),
6971
},
7072
])
7173
.then((answers) => {
7274
const del = answers['Choose an account']
73-
client.settings.set('delegation', del)
75+
settings.set('delegation', del)
7476
console.log(`now using account: ${del}`)
7577
})
7678
}

src/commands/settings/reset.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ const handler = async (args) => {
2828
type: 'confirm',
2929
default: false,
3030
})
31-
31+
const settings = await client.settings
3232
if (reset) {
33-
client.settings.clear()
33+
settings.clear()
3434
view.succeed('Settings cleared.')
3535
} else {
3636
view.info('exiting')

0 commit comments

Comments
 (0)