Skip to content

Commit 3ad9573

Browse files
committed
fix: identities/CommandAuthenticate is logic now more concise
1 parent 4a0e9ae commit 3ad9573

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

src/identities/CommandAuthenticate.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,27 @@ class CommandAuthenticate extends CommandPolykey {
7575
'Use any additional additional properties to complete authentication\n',
7676
);
7777
identitiesUtils.browser(message.request.url);
78-
process.stdout.write(
79-
binUtils.outputFormatter({
80-
type: options.format === 'json' ? 'json' : 'dict',
81-
data: {
82-
url: message.request.url,
83-
...(options.format === 'json'
84-
? { dataMap: message.request.dataMap }
85-
: message.request.dataMap),
86-
},
87-
}),
88-
);
78+
if (options.format === 'json') {
79+
process.stdout.write(
80+
binUtils.outputFormatter({
81+
type: 'json',
82+
data: {
83+
url: message.request.url,
84+
dataMap: message.request.dataMap,
85+
},
86+
}),
87+
);
88+
} else {
89+
process.stdout.write(
90+
binUtils.outputFormatter({
91+
type: 'dict',
92+
data: {
93+
url: message.request.url,
94+
...message.request.dataMap,
95+
},
96+
}),
97+
);
98+
}
8999
} else if (message.response != null) {
90100
process.stderr.write(
91101
`Authenticated digital identity provider ${providerId}\n`,

0 commit comments

Comments
 (0)