-
Notifications
You must be signed in to change notification settings - Fork 146
Mahdiyeh/Fix: get trader tokens from copytrading_list api #1594
base: master
Are you sure you want to change the base?
Mahdiyeh/Fix: get trader tokens from copytrading_list api #1594
Conversation
src/copytrade/copytrade.es6
Outdated
@@ -11,7 +11,7 @@ import validateToken from 'websockets/validateToken'; | |||
import { init as instrumentPromise } from '../instruments/instruments'; | |||
|
|||
// While using copy trader, this cannot be NULL | |||
const getLoggedInUserId = () => local_storage.get("oauth")[0].id; | |||
const getLoggedInUserId = local_storage.get("oauth")[0].id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const getLoggedInUserId = local_storage.get("oauth")[0].id; | |
const loggedInUserId = local_storage.get("oauth")[0].id; |
src/copytrade/copytrade.es6
Outdated
@@ -22,7 +22,7 @@ const form_error_messages = { | |||
REFRESH_FAILED: 'Refresh failed'.i18n(), | |||
}; | |||
|
|||
const getStorageName = () => `copyTrade_${getLoggedInUserId()}`; | |||
const getStorageName = () => `copyTrade_${getLoggedInUserId}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const getStorageName = () => `copyTrade_${getLoggedInUserId}`; | |
const getStorageName = () => `copyTrade_${loggedInUserId}`; |
src/copytrade/copytrade.es6
Outdated
@@ -98,12 +98,16 @@ const refreshTraderStats = (loginid, token, scope) => { | |||
//Check if we already added this trader. If yes, then merge the changes | |||
if (traderTokenDetails) { | |||
_.merge(traderTokenDetails.traderStatistics, copyStatData.copytrading_statistics); | |||
//check if copy trading is started |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//check if copy trading is started | |
// check if copy trading is started |
src/copytrade/copytrade.es6
Outdated
if (settings.get_settings.allow_copiers) { | ||
state.is_loading = false; | ||
} else { | ||
//update trader tokens and Refresh locally stored trader statistics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//update trader tokens and Refresh locally stored trader statistics | |
// update trader tokens and refresh locally stored trader statistics |
src/copytrade/copytrade.es6
Outdated
for (let traderToken of traderTokens) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we put the try/catch
block just before the for
loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we don't want to continue the loop even if an exception occurs during one iteration, the exception handler should be outside the loop, you're right.
src/copytrade/copytrade.es6
Outdated
liveapi.events.on("logout", () => { | ||
if (getStorageName() && local_storage.get(getStorageName())) { | ||
local_storage.remove(getStorageName()); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
liveapi.events.on("logout", () => { | |
if (getStorageName() && local_storage.get(getStorageName())) { | |
local_storage.remove(getStorageName()); | |
} | |
}); | |
liveapi.events.on("logout", () => { | |
const storageName = getStorageName(); | |
if (storageName && local_storage.get(storageName)) { | |
local_storage.remove(storageName); | |
} | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To have 1 function call instead of 3
No description provided.