mirror of
https://github.com/skydiver/ewelink-api.git
synced 2025-12-21 21:33:11 +01:00
fixed bug with undefined variable
This commit is contained in:
8
main.js
8
main.js
@@ -3,12 +3,14 @@ const W3CWebSocket = require('websocket').w3cwebsocket;
|
|||||||
const WebSocketAsPromised = require('websocket-as-promised');
|
const WebSocketAsPromised = require('websocket-as-promised');
|
||||||
const delay = require('delay');
|
const delay = require('delay');
|
||||||
|
|
||||||
|
const { _get } = require('./lib/helpers');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
makeAuthorizationSign,
|
makeAuthorizationSign,
|
||||||
loginPayload,
|
loginPayload,
|
||||||
wssLoginPayload,
|
wssLoginPayload,
|
||||||
wssUpdatePayload,
|
wssUpdatePayload,
|
||||||
} = require('./lib/helper');
|
} = require('./lib/ewelink-helper');
|
||||||
|
|
||||||
class eWeLink {
|
class eWeLink {
|
||||||
constructor({ region = 'us', email, password }) {
|
constructor({ region = 'us', email, password }) {
|
||||||
@@ -51,8 +53,8 @@ class eWeLink {
|
|||||||
body,
|
body,
|
||||||
json: true,
|
json: true,
|
||||||
});
|
});
|
||||||
this.apiKey = response.user.apikey;
|
this.apiKey = _get(response, 'user.apikey', '');
|
||||||
this.at = response.at;
|
this.at = _get(response, 'at', '');
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user