本文整理汇总了TypeScript中common-app.LoginActions类的典型用法代码示例。如果您正苦于以下问题:TypeScript LoginActions类的具体用法?TypeScript LoginActions怎么用?TypeScript LoginActions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LoginActions类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: handleError
private handleError(error) {
let emitError: IActionError = {
error: error.code,
message: error.message
};
LoginActions.errorNotification(emitError);
}
示例2: transformUser
.on('value', (snapshot) => {
const savedProfile:IUser = snapshot.val();
const newUserInfo = transformUser(fbuser, savedProfile);
console.log(newUserInfo);
subject.next(LoginActions.currentUserChangeFactory(newUserInfo))
});
示例3: reject
Meteor.logout((error) => {
if (error) {
console.error('Error logging out')
console.error(error)
reject(ReduxModuleUtil.errorFactory(LoginActions.LOGIN_ERROR, error));
} else {
resolve(LoginActions.loggedOutFactory());
}
});
示例4: isAuto
let subscription = timer.subscribe(() => {
let meteorUser = Meteor.user();
if (meteorUser) {
subject.next( LoginActions.loginSuccessFactory(
this.userFromMeteorUser(meteorUser),
meteorUser._id,
isAuto(lastLoginState)
));
subject.complete();
subscription.unsubscribe();
}
});
示例5: function
function (error, numberAffected: number) {
if (error) {
console.error(error);
reject(ReduxModuleUtil.errorFactory(LoginActions.LOGIN_ERROR, error));
} else {
if (numberAffected === 1) {
resolve(LoginActions.saveUserResponseFactory(edittedUserObject));
} else {
let errorDescription: string = 'Unexpected number of records affected. (' + numberAffected + ')';
console.error(errorDescription);
reject(ReduxModuleUtil.errorFactory(LoginActions.LOGIN_ERROR, error));
}
}
}
示例6: watchForAutoLogin
watchForAutoLogin(): Observable<ILoginActionPayload> {
const isAuto = ( loginState: ILoginState ): boolean => {
if (loginState)
return loginState.userId === null;
return false;
};
let meteorUser = Meteor.user();
let lastLoginState = null;
ReduxPackageCombiner
.select(LOGIN_PACKAGE_NAME)
.subscribe((loginState: ILoginState) => {
lastLoginState = loginState;
});
if (meteorUser) {
return Observable.of(LoginActions.loginSuccessFactory(
this.userFromMeteorUser(meteorUser),
meteorUser._id,
isAuto(lastLoginState)
));
}
let subject = new Subject();
let timer = Observable.timer(500, 1000);
let subscription = timer.subscribe(() => {
let meteorUser = Meteor.user();
if (meteorUser) {
subject.next( LoginActions.loginSuccessFactory(
this.userFromMeteorUser(meteorUser),
meteorUser._id,
isAuto(lastLoginState)
));
subject.complete();
subscription.unsubscribe();
}
});
return subject;
};
示例7:
Tracker.autorun( () => {
let user = Meteor.user();
console.log(user)
subject.next( LoginActions.currentUserChangeFactory(this.userFromMeteorUser(user)))
});