Skip to content

Commit

Permalink
isOnline status check
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Mar 31, 2021
1 parent 79ab45d commit 1499170
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/src/accounts/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export default class Account {

login() {
this.logger.info('Attempting to logging In');
if(this.isOnline()) {
this.logger.warn('Login attempt, but we are already logged in');
return;
}
const { client, options, manager, trader } = this;
const { username, password } = options.login;
client.logOn({
Expand All @@ -58,10 +62,18 @@ export default class Account {
}

logoff() {
this.logger.info(`Logging Off`);
this.logger.info(`Attempting to log Off`);
if(!this.isOnline()) {
this.logger.warn('Logoff attempt, but we are already logged off');
return;
}
this.client.logOff();
}

isOnline() {
return !!this.client.steamID;
}

private onLogin() {
this.logger.info('We logged in');
const { options, client } = this;
Expand Down

0 comments on commit 1499170

Please sign in to comment.