本文整理汇总了TypeScript中entcore.http函数的典型用法代码示例。如果您正苦于以下问题:TypeScript http函数的具体用法?TypeScript http怎么用?TypeScript http使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了http函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
$scope.connect = function () {
console.log('connect');
// picking up values manually because the browser autofill isn't registered by angular
http().post('/auth/login', http().serialize({
email: $('#email').val(),
password: $('#password').val(),
rememberMe: $scope.user.rememberMe,
secureLocation: $scope.user.secureLocation,
callBack: $scope.callBack,
details: $scope.details
}))
.done(function (data) {
if (typeof data !== 'object') {
if (window.location.href.indexOf('callback=') !== -1) {
window.location.href = (window as any).unescape(window.location.href.split('callback=')[1]);
}
else {
window.location.href = $scope.callBack;
}
}
if (data.error) {
$scope.error = data.error.message;
}
if (!$scope.$$phase) {
$scope.$apply();
}
});
};
示例2: function
$scope.forgotId = function({mail, firstName, structureId}, service){
resetError();
http().postJson('/auth/forgot-id', {mail: mail, firstName: firstName, structureId: structureId, service: service})
.done(function(data){
if(data.structures){
$scope.structures = data.structures;
if(firstName === null || structureId === null){
$scope.user.mode = 'idExtras'
}else{
$scope.user.mode = 'notFound';
setError('auth.notify.non.unique.result.mail');
}
}else {
notify.info("auth.notify." + service + ".sent")
if (data.mobile) {
$scope.user.channels = {
mobile: data.mobile
}
} else {
$scope.user.channels = {}
}
}
$scope.$apply()
})
.e400(function(data){
const err = JSON.parse(data.responseText);
if(err.error=="no.match" && $scope.user.mode=="idExtras"){
setError('auth.notify.no.match.mail.laststep');
}else{
setError('auth.notify.' + err.error + '.mail');
}
$scope.$apply()
})
}
示例3: function
const loadThemeConf = async function(){
await skin.listSkins();
conf = skin.themeConf;
$scope.themes = skin.skins;
if($scope.themes.length > 1){
$scope.display.pickTheme = skin.pickSkin;
http().get('/userbook/preference/theme').done(function(pref){
if(pref.preference){
$scope.account.themes[pref.preference] = true;
}
else{
$scope.account.themes[skin.skin] = true;
http().put('/userbook/preference/theme', skin.skin);
}
$scope.$apply();
})
if(!$scope.account.themes){
$scope.account.themes = {};
}
$scope.$apply();
}
}
示例4: http
http().get('/userbook/user-preferences').done(function(result){
Birthday.currentClass = { id: result.result[0].userPreferencesBirthdayClass };
http().get('/userbook/person/birthday').done(function(birthdays){
lang.addBundle('/directory/i18n', function(){
Birthday.emptyList = lang.translate('nobirthday');
Birthday.birthdays = _.filter(birthdays, function(birthday){
return moment(birthday.birthDate).month() === moment().month();
});
Birthday.birthdays = Birthday.birthdays.sort(function(a, b){
return moment(a.birthDate).date() - moment(b.birthDate).date()
});
var classes = [];
classes = _.pluck(Birthday.birthdays, 'classes');
classes.forEach(function(classList){
classList.forEach(function(myClass){
if(!_.findWhere(Birthday.classes, {id :myClass[0] })){
Birthday.classes.push({
name: myClass[1],
id: myClass[0]
});
}
});
});
Birthday.currentClass = _.findWhere(Birthday.classes, { id: Birthday.currentClass.id })
if(!Birthday.currentClass){
Birthday.currentClass = Birthday.classes[0];
}
model.widgets.apply();
});
});
});
示例5: function
loadGroups: function(){
var that = this
http().get('/userbook/structure/' + this.search.structure.id).done(function(structure){
this.search.groups = structure.profileGroups.concat(structure.manualGroups);
_.map(this.search.groups, function(group){ group.translatedName = that.groupTranslation(group.name) })
this.$apply('search');
}.bind(this));
},
示例6: function
send: function () {
this.message.to = _.map(this.snipletResource.shared, function (shared) { return shared.userId || shared.groupId });
this.message.to.push(this.snipletResource.owner.userId);
http().postJson('/conversation/send', this.message).done(function () {
notify.info('ml.sent');
}).e401(function () { });
this.message = {}
}
示例7: http
$scope.setThemePreferences = (themeName: string) => {
const addedThemes = [];
for(let name in $scope.account.themes){
if($scope.account.themes[name]){
addedThemes.push(name);
}
}
if(addedThemes.length > 1){
const keptTheme = $scope.themes.find(t => t.parent === 'theme-open-ent').child;
http().put('/userbook/preference/theme', keptTheme);
}
else{
http().put('/userbook/preference/theme', addedThemes[0]);
}
};
示例8: function
$scope.addBookmark = function($item){
if(_.findWhere(model.me.bookmarkedApps, { name: $item.name }) !== undefined){
return;
}
model.me.bookmarkedApps.push($item);
$scope.$apply();
http().putJson('/userbook/preference/apps', model.me.bookmarkedApps);
};
示例9: function
sync: function(){
oldHttp().get('/directory/class/' + model.me.preferences.selectedClass + '/users', { requestName: 'loadingUsers' }).done(function(data){
data.sort(function(a, b) {
return a.lastName > b.lastName?1:-1;
});
this.load(data);
}.bind(this));
},