|
@@ -10,8 +10,7 @@
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
|
-import Trottle from 'lodash/throttle'
|
|
|
-import { Component, Prop, Vue, Watch } from 'vue-property-decorator'
|
|
|
+import { Component, Prop, Vue } from 'vue-property-decorator'
|
|
|
import { getLoginMessageByGoogleIdToken } from '../assets/js/__message-util';
|
|
|
|
|
|
@Component
|
|
@@ -19,68 +18,18 @@ export default class GoogleLogin extends Vue {
|
|
|
@Prop() public connection;
|
|
|
idToken: string = ''
|
|
|
|
|
|
- // @Watch('connection')
|
|
|
- // updateConn(value, oldValue) {
|
|
|
- // console.log('updateconn')
|
|
|
- // this.conn = value
|
|
|
- // }
|
|
|
-
|
|
|
loginDisabled(){
|
|
|
if ( this.idToken == null ) return true;
|
|
|
return this.idToken == null || this.connection.socketId == null
|
|
|
}
|
|
|
+
|
|
|
mounted(){
|
|
|
this.idToken = (new URLSearchParams(window.location.search)).get('id_token')
|
|
|
}
|
|
|
|
|
|
- // async startSession() {
|
|
|
- // const ucpId = await this.getResponse( getLoginMessageByGoogleIdToken(this.idToken, 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
|
|
|
- // })
|
|
|
- // }
|
|
|
-
|
|
|
- // getResponse = Trottle(async (request, operation: string, getReturnData: (response) => any ) => {
|
|
|
- // this.startLoading()
|
|
|
- // this.addMessage(operation + ' ...')
|
|
|
- // let returnData = null
|
|
|
- // try {
|
|
|
- // const results = await this.getResponses(request)
|
|
|
- // // look for error
|
|
|
- // const responseException = results.find( (r: any) => r?.header?.messageType == 'ResponseException' )
|
|
|
-
|
|
|
- // if( responseException != null ){
|
|
|
- // throw Error(responseException?.data)
|
|
|
- // }
|
|
|
- // // look for response
|
|
|
- // const response = results.find( (r: any) => {
|
|
|
- // const messageType = r?.header?.messageType
|
|
|
- // return ['FisResponse','Response'].indexOf(messageType) > -1
|
|
|
- // })
|
|
|
- // if(response == null){
|
|
|
- // throw Error('fail to get success response')
|
|
|
- // }
|
|
|
-
|
|
|
- // // try extract data
|
|
|
- // returnData = getReturnData(response)
|
|
|
-
|
|
|
- // this.addMessage(operation + ' success.')
|
|
|
- // } catch (error) {
|
|
|
- // this.addMessage(operation + ' fail :' + error)
|
|
|
- // }
|
|
|
- // this.endLoading()
|
|
|
-
|
|
|
- // console.log('results', returnData)
|
|
|
- // return returnData;
|
|
|
- // })
|
|
|
-
|
|
|
-
|
|
|
loginUsingIdToken(){
|
|
|
this.$emit('loginAction',{
|
|
|
- request: getLoginMessageByGoogleIdToken(this.idToken, 10000),
|
|
|
+ request: getLoginMessageByGoogleIdToken(this.idToken, 1000),
|
|
|
title: 'signin GoogleIdToken',
|
|
|
handle: (response) => {
|
|
|
const ucpId = response?.data?.ucpId
|
|
@@ -88,8 +37,6 @@ export default class GoogleLogin extends Vue {
|
|
|
return ucpId
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</script>
|