Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "core/CvLogin"

Index

Variables

CvLogin

CvLogin: ClassicComponentClass<CvLoginProps> = React.createClass<CvLoginProps, CvLoginState>({mixins: [CvBaseMixin],componentDidMount: function () {},getChildContext: function () {return this.getDefaultChildContext();},getDefaultProps: function () {return {actionListeners: [],loginListeners: [],renderer: null}},render: function () {if (this.props.renderer) {return this.props.renderer(this.getChildContext().cvContext, this._getCallbackObject());} else {return null;}},_getCallbackObject: function ():CvLoginCallback {return {isLoggedIn: ():boolean => {return this.catavolt().isLoggedIn;},login: (gatewayHost:string, tenantId:string, clientType:string,userId:string, password:string, resultCallback?:CvResultCallback<CvLoginResult>)=> {this._publishActionStarted('#login');this._postLogin(this.catavolt().login(gatewayHost, tenantId, clientType, userId, password), resultCallback);},loginDirectly: (url:string, tenantId:string, clientType:string,userId:string, password:string, resultCallback?:CvResultCallback<CvLoginResult>)=> {this._publishActionStarted('#login');this._postLogin(this.catavolt().loginDirectly(url, tenantId, clientType, userId, password), resultCallback);}}},_postLogin: function (loginResult:Future<AppWinDef>, resultCallback?:CvResultCallback<CvLoginResult>) {loginResult.onComplete((appWinDefTry:Try<AppWinDef>) => {this._publishActionFinished('#login');if (appWinDefTry.isSuccess) {CvSessionManager.storeSession(this.catavolt().sessionContextTry.success);const eventRegistry:CvEventRegistry = this.eventRegistry();const event:CvEvent<CvLoginResult> = {type: CvEventType.LOGIN,resourceId: CvResourceManager.resourceIdForObject(appWinDefTry.success, this.catavolt()),eventObj: {appWinDef: appWinDefTry.success}};if(resultCallback && typeof resultCallback === 'function') {resultCallback(event.eventObj);}eventRegistry.publish<CvLoginResult>(event, CvResourceManager.shouldCacheResult(this.eventRegistry()));this.props.loginListeners.forEach((listener)=> {listener(event)});} else {const event:CvEvent<CvMessage> = {type: CvEventType.MESSAGE,eventObj: {message: 'Login failed', messageObj: appWinDefTry.failure, type: CvMessageType.ERROR}}if(resultCallback && typeof resultCallback === 'function') {resultCallback(null, appWinDefTry.failure);}this.eventRegistry().publish(event, false);}});},_publishActionStarted: function (actionId:string):void {const e:CvEvent<CvActionFiredResult> = {type: CvEventType.ACTION_FIRED,eventObj: {actionId: actionId,type: CvActionFiredResultType.ACTION_STARTED,source: null,clientAction: false}};this.props.actionListeners.forEach((listener)=> {listener(e)});(this.eventRegistry() as CvEventRegistry).publish<CvActionFiredResult>(e, false);},_publishActionFinished: function (actionId:string):void {const e:CvEvent<CvActionFiredResult> = {type: CvEventType.ACTION_FIRED,eventObj: {actionId: actionId,type: CvActionFiredResultType.ACTION_COMPLETED,source: null,clientAction: false}};this.props.actionListeners.forEach((listener)=> {listener(e)});(this.eventRegistry() as CvEventRegistry).publish<CvActionFiredResult>(e, false);}})

Generated using TypeDoc