Skip to content

Commit 5b82791

Browse files
committed
refactor: align return API
BREAKING CHANGE: changes the return type of getAccountInfo()
1 parent 4944ed4 commit 5b82791

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/api/getAccountInfo.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void describe('getAccountInfo()', () => {
1818
}) as any,
1919
)
2020
assert.equal('error' in res, false)
21-
check(res).is(
21+
check('result' in res && res.result).is(
2222
objectMatching({
2323
mqttEndpoint: 'mqtt.nrfcloud.com',
2424
mqttTopicPrefix: 'prod/b8b26bc5-2814-4063-b4fa-83ecddb2fec7/',

src/api/getAccountInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const getAccountInfo = async (
2121
endpoint: URL
2222
},
2323
fetchImplementation?: typeof fetch,
24-
): Promise<{ error: Error | ValidationError } | AccountInfo> => {
24+
): Promise<{ error: Error | ValidationError } | { result: AccountInfo }> => {
2525
const maybeAccount = await validatedFetch(
2626
{
2727
endpoint,
@@ -36,5 +36,5 @@ export const getAccountInfo = async (
3636
)
3737

3838
if ('error' in maybeAccount) return maybeAccount
39-
return maybeAccount.result
39+
return maybeAccount
4040
}

0 commit comments

Comments
 (0)