Skip to content

Commit af8f263

Browse files
committed
Improve call to /v2/homepage
1 parent 2759c94 commit af8f263

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/mixins/getHomepage.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,27 @@ module.exports = {
1212
uri: `/v2/homepage`,
1313
});
1414

15+
const response = await this.makeRequest({
16+
method: "post",
17+
uri: `/v2/homepage`,
18+
body: {
19+
getFamily: {},
20+
getThing: {},
21+
},
22+
});
23+
1524
const error = _get(response, 'error', false);
16-
const data = _get(response, 'data', false);
25+
const familyInfo = _get(response, 'familyInfo', false);
26+
const thingInfo = _get(response, 'thingInfo', false);
1727

1828
if (error) {
1929
throw new Error(`[${error}] ${errors[error]}`);
2030
}
2131

22-
if (!data) {
32+
if (!familyInfo || !thingInfo) {
2333
throw new Error(`${errors.noDevices}`);
2434
}
2535

26-
return data
36+
return { familyInfo, thingInfo };
2737
},
2838
};

0 commit comments

Comments
 (0)