Adding saweb-api module.
This commit is contained in:
1 parent
42857554b7
commit
263a3fceba
5 files changed
+158
-10
No files matched your search
@@ -9,6 +9,8 @@ import { client } from '../graphql/apollo'
|
||||
|
||||
import { AUTH_CONFIG } from './Auth0' // create by renaming Auth0.sample.js to Auth0.js and setting vars
|
||||
|
||||
import { setInitialEcosystem } from '../utils/ecosystem'
|
||||
|
||||
const AUTHENTICATE = gql`
|
||||
mutation authenticate($idToken: String!) {
|
||||
users_Authenticate(idToken: $idToken) {
|
||||
@@ -249,6 +251,9 @@ class Auth {
|
||||
}
|
||||
}
|
||||
setItem('user', JSON.stringify(user))
|
||||
|
||||
await setInitialEcosystem()
|
||||
|
||||
window.location.href = '/'
|
||||
return response.data
|
||||
} catch (err) {
|
||||
@@ -261,6 +266,7 @@ class Auth {
|
||||
window.localStorage.removeItem('access_token')
|
||||
window.localStorage.removeItem('user')
|
||||
window.localStorage.removeItem('name')
|
||||
window.localStorage.removeItem('ecosystem')
|
||||
deleteCookie('ajs_anonymous_id')
|
||||
deleteCookie('ajs_user_id')
|
||||
deleteCookie('current_tenant')
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const ECOSYSTEM_QUERY = gql`
|
||||
query {
|
||||
web_GetEcosystem {
|
||||
id
|
||||
devTeams {
|
||||
codeName
|
||||
displayName
|
||||
host {
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
bots {
|
||||
codeName
|
||||
displayName
|
||||
type
|
||||
repo
|
||||
configFile
|
||||
products{
|
||||
codeName
|
||||
displayName
|
||||
description
|
||||
dataSets{
|
||||
codeName
|
||||
type
|
||||
validPeriods
|
||||
filePath
|
||||
fileName
|
||||
dataRange{
|
||||
filePath
|
||||
fileName
|
||||
}
|
||||
}
|
||||
exchangeList{
|
||||
name
|
||||
}
|
||||
plotter{
|
||||
devTeam
|
||||
codeName
|
||||
moduleName
|
||||
repo
|
||||
}
|
||||
}
|
||||
}
|
||||
plotters {
|
||||
codeName
|
||||
displayName
|
||||
modules{
|
||||
codeName
|
||||
moduleName
|
||||
description
|
||||
profilePicture
|
||||
panels{
|
||||
codeName
|
||||
moduleName
|
||||
event
|
||||
}
|
||||
}
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
}
|
||||
hosts {
|
||||
codeName
|
||||
displayName
|
||||
host {
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
competitions {
|
||||
codeName
|
||||
displayName
|
||||
description
|
||||
startDatetime
|
||||
finishDatetime
|
||||
formula
|
||||
plotter{
|
||||
devTeam
|
||||
codeName
|
||||
host{
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
moduleName
|
||||
repo
|
||||
}
|
||||
rules
|
||||
prizes
|
||||
participants
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
plotters {
|
||||
codeName
|
||||
displayName
|
||||
modules{
|
||||
codeName
|
||||
moduleName
|
||||
description
|
||||
profilePicture
|
||||
panels{
|
||||
codeName
|
||||
moduleName
|
||||
event
|
||||
}
|
||||
}
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -5,6 +5,7 @@ import MasterApp from './App'
|
||||
import { createStore } from 'redux'
|
||||
import { Provider } from 'react-redux'
|
||||
import rootReducer from './reducers/rootReducer'
|
||||
import { setInitialEcosystem } from './utils/ecosystem'
|
||||
|
||||
const store = createStore(rootReducer)
|
||||
|
||||
@@ -12,6 +13,8 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
window.localStorage.setItem('debug', 'advanced-algos:*')
|
||||
}
|
||||
|
||||
setInitialEcosystem()
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<MasterApp />
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { client } from '../graphql/apollo'
|
||||
import { ECOSYSTEM_QUERY } from '../graphql/EcosystemQuery'
|
||||
import Log from './log'
|
||||
|
||||
export async function setInitialEcosystem() {
|
||||
try {
|
||||
const ecosystem = await client.query({ query: ECOSYSTEM_QUERY })
|
||||
window.localStorage.setItem('ecosystem', JSON.stringify(ecosystem.data.web_GetEcosystem))
|
||||
} catch (error) {
|
||||
Log.error('Error getting the ecosystem: ' + error)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user