|
@@ -191,6 +191,7 @@ export default class UiClient extends Vue {
|
|
cancelRequest: null,
|
|
cancelRequest: null,
|
|
}
|
|
}
|
|
url = 'http://localhost:3011';
|
|
url = 'http://localhost:3011';
|
|
|
|
+ // url = 'http://swopt.com:3011';
|
|
messages: Message[] = [];
|
|
messages: Message[] = [];
|
|
loading: boolean = false
|
|
loading: boolean = false
|
|
modal: boolean = false
|
|
modal: boolean = false
|
|
@@ -257,7 +258,7 @@ export default class UiClient extends Vue {
|
|
const responseException = results.find( (r: any) => r?.header?.messageType == 'ResponseException' )
|
|
const responseException = results.find( (r: any) => r?.header?.messageType == 'ResponseException' )
|
|
|
|
|
|
if( responseException != null ){
|
|
if( responseException != null ){
|
|
- throw Error(responseException?.data)
|
|
|
|
|
|
+ throw new Error(responseException?.data)
|
|
}
|
|
}
|
|
// look for response
|
|
// look for response
|
|
const response = results.find( (r: any) => {
|
|
const response = results.find( (r: any) => {
|
|
@@ -265,7 +266,7 @@ export default class UiClient extends Vue {
|
|
return ['FisResponse','Response'].indexOf(messageType) > -1
|
|
return ['FisResponse','Response'].indexOf(messageType) > -1
|
|
})
|
|
})
|
|
if(response == null){
|
|
if(response == null){
|
|
- throw Error('fail to get success response')
|
|
|
|
|
|
+ throw new Error('fail to get success response')
|
|
}
|
|
}
|
|
|
|
|
|
// try extract data
|
|
// try extract data
|
|
@@ -282,20 +283,25 @@ export default class UiClient extends Vue {
|
|
})
|
|
})
|
|
|
|
|
|
async startSession() {
|
|
async startSession() {
|
|
- this.session.ucpId = await this.getResponse( getLoginMessage(10000), 'signin', (response) => {
|
|
|
|
- console.log('response2', response)
|
|
|
|
- const ucpId = response?.data?.ucpId
|
|
|
|
- if( ucpId == null) throw Error('missing ucpId')
|
|
|
|
- console.log('ucpId', ucpId)
|
|
|
|
- return ucpId
|
|
|
|
- })
|
|
|
|
|
|
+ this.session.ucpId = await this.getResponse(
|
|
|
|
+ getLoginMessage(10000),
|
|
|
|
+ 'signin',
|
|
|
|
+ (response) => {
|
|
|
|
+ const ucpId = response?.data?.ucpId
|
|
|
|
+ if( ucpId == null) throw new Error('missing ucpId')
|
|
|
|
+ return ucpId
|
|
|
|
+ }
|
|
|
|
+ )
|
|
}
|
|
}
|
|
|
|
|
|
async endSession() {
|
|
async endSession() {
|
|
this.session.ucpId = await this.getResponse(
|
|
this.session.ucpId = await this.getResponse(
|
|
getLogoutMessage(this.session.ucpId),
|
|
getLogoutMessage(this.session.ucpId),
|
|
'signout',
|
|
'signout',
|
|
- _ => null
|
|
|
|
|
|
+ (data) => {
|
|
|
|
+ console.log('endSession',JSON.stringify(data?.data,null,3))
|
|
|
|
+ return null
|
|
|
|
+ },
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -303,7 +309,12 @@ export default class UiClient extends Vue {
|
|
this.form.type = await this.getResponse(
|
|
this.form.type = await this.getResponse(
|
|
getNewPurchaseRequisition(this.session.ucpId),
|
|
getNewPurchaseRequisition(this.session.ucpId),
|
|
'new product requisition',
|
|
'new product requisition',
|
|
- _ => 'productrequisition',
|
|
|
|
|
|
+ (data) => {
|
|
|
|
+ if( data?.data != 1 ) {
|
|
|
|
+ new Error('expected 1 but got ' + JSON.stringify(data?.data) )
|
|
|
|
+ }
|
|
|
|
+ return 'productrequisition'
|
|
|
|
+ },
|
|
)
|
|
)
|
|
this.form.docDt = "2021-01-10Z"
|
|
this.form.docDt = "2021-01-10Z"
|
|
this.form.cancelRequest = getCancelPurchaseRequisition(this.session.ucpId)
|
|
this.form.cancelRequest = getCancelPurchaseRequisition(this.session.ucpId)
|
|
@@ -312,7 +323,12 @@ export default class UiClient extends Vue {
|
|
this.form.type = await this.getResponse(
|
|
this.form.type = await this.getResponse(
|
|
getNewUserProfile(this.session.ucpId),
|
|
getNewUserProfile(this.session.ucpId),
|
|
'new user profile',
|
|
'new user profile',
|
|
- _ => 'userprofile',
|
|
|
|
|
|
+ (data) => {
|
|
|
|
+ if( data?.data != 1 ) {
|
|
|
|
+ throw new Error('expected 1 but got ' + JSON.stringify(data?.data) )
|
|
|
|
+ }
|
|
|
|
+ return 'userprofile'
|
|
|
|
+ },
|
|
)
|
|
)
|
|
this.form.userName = "abcxyz"
|
|
this.form.userName = "abcxyz"
|
|
this.form.cancelRequest = getCancelUserProfile(this.session.ucpId)
|
|
this.form.cancelRequest = getCancelUserProfile(this.session.ucpId)
|
|
@@ -321,7 +337,10 @@ export default class UiClient extends Vue {
|
|
this.form.type = await this.getResponse(
|
|
this.form.type = await this.getResponse(
|
|
this.form.cancelRequest,
|
|
this.form.cancelRequest,
|
|
'cancel changes',
|
|
'cancel changes',
|
|
- _ => null,
|
|
|
|
|
|
+ (data) => {
|
|
|
|
+ console.log('cancel changes',JSON.stringify(data?.data,null,3))
|
|
|
|
+ return null
|
|
|
|
+ },
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -383,7 +402,7 @@ export default class UiClient extends Vue {
|
|
const results = await this.client.getAllResponsesFromRequest(getLogoutMessage(this.session.ucpId))
|
|
const results = await this.client.getAllResponsesFromRequest(getLogoutMessage(this.session.ucpId))
|
|
const response = results.find( (r: any) => r?.header?.messageType == 'Response' )
|
|
const response = results.find( (r: any) => r?.header?.messageType == 'Response' )
|
|
|
|
|
|
- if(response == null) throw Error('fail to get success response')
|
|
|
|
|
|
+ if(response == null) throw new Error('fail to get success response')
|
|
|
|
|
|
console.log('response',response);
|
|
console.log('response',response);
|
|
|
|
|
|
@@ -399,7 +418,13 @@ export default class UiClient extends Vue {
|
|
await this.getResponse(
|
|
await this.getResponse(
|
|
getSetPurchaseRequisitionDocDt(this.session.ucpId, this.form.docDt),
|
|
getSetPurchaseRequisitionDocDt(this.session.ucpId, this.form.docDt),
|
|
'setItem docDt',
|
|
'setItem docDt',
|
|
- _ => null,
|
|
|
|
|
|
+ (data) => {
|
|
|
|
+ if( data?.data?.Result != 1) {
|
|
|
|
+ throw new Error('expect data.Result = 1 but got ' + JSON.stringify(data?.data))
|
|
|
|
+ }
|
|
|
|
+ // console.log('setItemDocDt',JSON.stringify(data?.data,null,3))
|
|
|
|
+ return null
|
|
|
|
+ },
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -407,7 +432,13 @@ export default class UiClient extends Vue {
|
|
await this.getResponse(
|
|
await this.getResponse(
|
|
getSetUserProfileUserName(this.session.ucpId, this.form.userName),
|
|
getSetUserProfileUserName(this.session.ucpId, this.form.userName),
|
|
'setItem userName',
|
|
'setItem userName',
|
|
- _ => null,
|
|
|
|
|
|
+ (data) => {
|
|
|
|
+ if( data?.data?.Result != 1) {
|
|
|
|
+ throw new Error('expect data.Result = 1 but got ' + JSON.stringify(data?.data))
|
|
|
|
+ }
|
|
|
|
+ console.log('setItemUserName',JSON.stringify(data?.data,null,3))
|
|
|
|
+ return null
|
|
|
|
+ },
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|