Access to Strategy System only when logged in

This commit is contained in:
Luis Fernando Molina committed 2019-05-12 14:26:19 +02:00
1 parent 2fcd49ff13
commit eb59fab260
4 files changed
+23 -8

No files matched your search

+1 -1
View File
@@ -121,7 +121,7 @@ function convertTimePeriodToName(pTimePeriod) {
window.AT_BREAKPOINT = false;
const LOGGED_IN_USER_LOCAL_STORAGE = "xuser"
const USDT_BTC_HTH = 19900; // This is needed to know the scale of the market time line.
const WIDHTER_VOLUME_BAR_BASE_FACTOR = 2.5;
+11 -2
View File
@@ -60,6 +60,13 @@
thisObject.status = 'MIDDLE'
let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE)
if (user !== null) { // Only if user is logged in
thisObject.container.isDraggeable = true
} else {
thisObject.container.isDraggeable = false
}
if (thisObject.container.frame.position.y > browserCanvas.height * 99.5 / 100 - BOTTOM_SPACE_HEIGHT) {
thisObject.container.frame.position.y = browserCanvas.height - BOTTOM_SPACE_HEIGHT
thisObject.status = 'BOTTOM'
@@ -204,7 +211,10 @@
browserCanvasContext.closePath()
browserCanvasContext.fill()
arrow()
let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE)
if (user !== null) { // Only if user is logged in
arrow()
}
}
function arrow () {
@@ -295,4 +305,3 @@
browserCanvasContext.stroke()
}
}
+2 -1
View File
@@ -26,7 +26,8 @@ function newStrategySpace () {
thisObject.tradingSystemWorkspace = newTradingSystemWorkspace()
// thisObject.tradingSystemWorkspace.container.connectToParent(thisObject.sidePanel.container, true, true)
await thisObject.tradingSystemWorkspace.initialize()
thisObject.tradingSystemWorkspace.initialize()
await thisObject.tradingSystemWorkspace.loadFromStrategyzer()
// thisObject.sidePanel.areas.push(thisObject.tradingSystemWorkspace)
}
+9 -4
View File
@@ -9,6 +9,7 @@ function newTradingSystemWorkspace () {
isDeployed: false,
strategies: undefined,
container: undefined,
loadFromStrategyzer: loadFromStrategyzer,
deploydTradingSystem: deploydTradingSystem,
draw: draw,
getContainer: getContainer,
@@ -33,10 +34,14 @@ function newTradingSystemWorkspace () {
return thisObject
async function initialize () {
}
async function loadFromStrategyzer () {
try {
const accessToken = window.localStorage.getItem('xaccess_token')
let user = window.localStorage.getItem('xuser')
let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE)
if (user === null) {
// if there is no user that means that we are logged off, which means this object can not be used.
return
@@ -100,7 +105,7 @@ function newTradingSystemWorkspace () {
resolve({ strategies: response.data.strategizer_StrategyByFb.subStrategies})
})
.catch(error => {
console.log('apolloClient error getting user strategies', error.graphQLErrors, error.stack)
if (ERROR_LOG === true) { logger.write('[ERROR] ApolloClient error getting user strategies -> err = ' + err.stack) }
reject(error)
})
})
@@ -115,10 +120,10 @@ function newTradingSystemWorkspace () {
await Promise.all(fetchDataPromises).then(result => {
}, err => {
console.error('[ERROR] Login -> GraphQL Fetch Error -> err = ', err.stack)
if (ERROR_LOG === true) { logger.write('[ERROR] GraphQL Fetch Error -> err = ' + err.stack) }
})
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err.stack) }
if (ERROR_LOG === true) { logger.write('[ERROR] loadFromStrategyzer -> err = ' + err.stack) }
}
}