Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
pladaria committed Aug 11, 2017
2 parents 421e557 + 3ff89d6 commit 3c39333
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ See [examples](./examples)

## Contributors

[martijndierckx](https://github.com/martijndierckx)
- [martijndierckx](https://github.com/martijndierckx)
- [Drag0s](https://github.com/Drag0s)

## License

Expand Down
Empty file added examples/get-client-info.js
Empty file.
21 changes: 15 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const create = (
id: sessionId,
account,
userToken: null,
clientInfo: null,
};

const checkSuccess = res => {
Expand Down Expand Up @@ -169,12 +170,20 @@ const create = (
log('updateClientInfo');
return fetch(`${BASE_TRADER_URL}/pa/secure/client?sessionId=${session.id}`)
.then(res => res.json())
.then(({intAccount, id}) => {
session.account = intAccount;
session.userToken = id;
.then(clientInfo => {
session.account = clientInfo.intAccount;
session.userToken = clientInfo.id;
this.clientInfo = clientInfo;
});
};

/**
* Get client info
*
* @return Client info
*/
const getClientInfo = () => this.clientInfo;

/**
* Login
*
Expand All @@ -201,8 +210,7 @@ const create = (
}
})
.then(updateClientInfo)
.then(() => session)
.catch(console.log);
.then(() => session);
};

/**
Expand Down Expand Up @@ -408,9 +416,10 @@ const create = (
getCashFunds,
getPortfolio,
getAskBidPrice,
getProductsByIds,
getClientInfo,
// properties
session,
getProductsByIds,
};
};

Expand Down

0 comments on commit 3c39333

Please sign in to comment.