-
Notifications
You must be signed in to change notification settings - Fork 0
/
invokeTree.js
46 lines (43 loc) · 1.31 KB
/
invokeTree.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Axios from "axios";
import tree_payload from './tree'
let tree_request = tree_payload
let authConfig = {
headers:{
"Content-Type":"application/json"
}
}
let authPayload = {
"ServiceRequestDetail": {
"ServiceRequestVersion": "2.0",
"OwnerId": "41",
"BrowserIp": "192.168.74.31",
"ResponseType": "json"
},
"UserCredential": {
"UserName": "britecoagent",
"Password": "sKVSbX7wj8UYYAaar4amxQ=="
}
}
let treeHeader = {
headers:{
'Content-Type':'application/json',
'Token':'',
'EventName':'GetUINavigationTreeV1',
'MODE':'LIVE',
'Environment':'15'
}
}
export const invokeTree = ()=>{
let tree_response = '';
Axios.post('https://ucicommonservice.solartis.net/CommonServiceV2_1/AuthenticationServiceV2/requestService',authPayload,authConfig).then(response=>{
const token = response.data.Token;
tree_request.ServiceRequestDetail.Token = token;
treeHeader.headers.Token = token
Axios.post('https://ucicomruntimev6-2.solartis.net/KnowledgeEngineV6_2/KnowledgeBase/FireEventV2',tree_request,treeHeader)
.then(res=>{tree_response=res.data})
.catch(err=>console.log(err))
}).catch(err=>console.log(err))
return (dispatch)=>{
dispatch({type:'INVOKE_TREE',payload:tree_response})
}
}