Skip to content

Commit

Permalink
Housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
Kienz committed Mar 6, 2022
1 parent f237a91 commit eab79c2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Releases

### v1.1.3
- Housekeeping

### v1.1.2
- Housekeeping

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-unifi-poe-control",
"version": "1.1.2",
"version": "1.1.3",
"description": "UniFi POE Control for Homebridge",
"main": "src/index.js",
"repository": "git://github.com/Kienz/homebridge-unifi-poe-control.git",
Expand Down
21 changes: 15 additions & 6 deletions src/UniFiAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ module.exports = class UniFiAPI {
headers['x-csrf-token'] = this.csrf;
}

if (!url || !this.url) {
this.log.error(`Please define a value for "url" in the config.`);
return;
}

config = {
method,
url,
Expand Down Expand Up @@ -101,12 +106,16 @@ module.exports = class UniFiAPI {

let url = (this.isUniFiOS) ? 'api/auth/login' : 'api/login';

await this._performRequest('POST', url, {
username: this.username,
password: this.password,
});

this.log.info('Successfully logged in to UniFi controller');
try {
await this._performRequest('POST', url, {
username: this.username,
password: this.password,
});

this.log.info('Successfully logged in to UniFi controller');
} catch (e) {
this.log.error(`Login error ${e} ${url}`);
}
}

_prefixUrl(url) {
Expand Down

0 comments on commit eab79c2

Please sign in to comment.