本文整理汇总了TypeScript中xhr.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: requestStore
requestStore() {
let option: any = {
url: `${Config.requestHost}/accountBookData`,
handleAs: 'json',
content: {
accountBook: this.currentAccountBook
}
};
xhr.get(option)
.then((data)=>{
if(data.state === stateCode.SUCCESS && dojo.isArray(data.accountBooks) && dojo.isArray(data.accounts)) {
this.store = data.accountBooks;
this.accountStore = data.accounts;
topic.publish('financeapp/accountBookData', this);
} else if(data.state === stateCode.Error) {
topic.publish('tipService/warning', data.info);
} else if(data.state === stateCode.NOTLOGGIN) {
topic.publish('tipService/warning', data.info);
user.logout();
} else {
topic.publish('tipService/warning', lang.xhrDataError);
}
}, (error)=>{
topic.publish('tipService/error', lang.xhrErr);
})
.then(()=>this.isRequesting = false);
this.isRequesting = true;
}
示例2: logout
logout() {
let option: any = {
url: `${Config.requestHost}/logout`,
handleAs: 'json'
};
xhr.get(option)
.then((data)=>{
if(!data.state || data.state != stateCode.SUCCESS) {
topic.publish('tipService/warning', data.info);
} else {
this.isLogin = false;
this.userName = '';
topic.publish('user/logout', this);
}
}, (error)=>{
});
}
示例3: register
register() {
let option: any = {
url: `${Config.requestHost}/getCaptcha?t=${(new Date()).getTime()}`,
handleAs: 'json'
};
xhr.get(option)
.then((data)=>{
if(!data.state || data.state != stateCode.SUCCESS) {
topic.publish('tipService/warning', data.info);
} else {
let geeData = JSON.parse(data.responseStr);
window.initGeetest({
gt: geeData.gt,
challenge: geeData.challenge,
product: "float",
offline: !geeData.success
}, this.handlerPopup.bind(this));
}
}, (error)=>{
});
}