本文整理汇总了TypeScript中@ngrx/effects.Actions类的典型用法代码示例。如果您正苦于以下问题:TypeScript Actions类的具体用法?TypeScript Actions怎么用?TypeScript Actions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Actions类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(actions$: Actions, toast: ToastService) {
actions$
.pipe(ofEntityOp(), filter((ea: EntityAction) => ea.payload.entityOp.endsWith(OP_SUCCESS) || ea.payload.entityOp.endsWith(OP_ERROR)))
// this service never dies so no need to unsubscribe
.subscribe(action => toast.openSnackBar(`${action.payload.entityName} action`, action.payload.entityOp));
actions$
.pipe(ofType(EntityCacheAction.SAVE_ENTITIES_SUCCESS, EntityCacheAction.SAVE_ENTITIES_ERROR))
.subscribe((action: any) => toast.openSnackBar(`${action.type} - url: ${action.payload.url}`, 'SaveEntities'));
}
示例2: ngOnInit
ngOnInit() {
this.paymentProvider = {
id: '',
name: '',
logo: null,
description: '',
black_white_logo: null,
background_color: '#00a263',
text_color: '#f4f4f4',
button_color: 'dark',
version: 1,
oauth_settings: {
client_id: '',
secret: '',
base_url: '',
token_path: '',
authorize_path: '',
scope: '',
},
currencies: [],
asset_types: [],
settings: {},
app_ids: [],
embedded_application: null,
};
this.store.dispatch(new GetBackendRogerthatAppsAction());
this.status$ = this.store.pipe(select(getBackendPaymentProviderEditStatus));
this.rogerthatApps$ = this.store.pipe(select(getBackendRogerthatApps));
this.sub = this.actions$.pipe(ofType(BackendsActionTypes.CREATE_PAYMENT_PROVIDER_COMPLETE)).subscribe(() => {
this.router.navigate([ '..' ], { relativeTo: this.route });
});
this.store.dispatch(new ListEmbeddedAppsAction(EmbeddedAppTag.PAYMENTS));
this.embeddedApplications$ = this.store.pipe(select(getEmbeddedApps));
}
开发者ID:our-city-app,项目名称:plugin-mobicage-control-center,代码行数:34,代码来源:create-payment-provider.component.ts
示例3: persistTodos
@Effect({ dispatch: false })
persistTodos() {
return this.actions$.pipe(
ofType<ActionTodosPersist>(TodosActionTypes.PERSIST),
tap(action =>
this.localStorageService.setItem(TODOS_KEY, action.payload.todos)
)
);
}
示例4: login
@Effect({ dispatch: false })
login() {
return this.actions$.pipe(
ofType<ActionAuthLogin>(AuthActionTypes.LOGIN),
tap(() =>
this.localStorageService.setItem(AUTH_KEY, { isAuthenticated: true })
)
);
}
示例5: ngOnInit
ngOnInit() {
this.embeddedApp$ = this.store.pipe(select(getEmbeddedApp), filterNull());
this.store.dispatch(new GetEmbeddedAppAction(this.route.snapshot.params.embeddedAppId));
this.getStatus$ = this.store.pipe(select(getEmbeddedAppStatus));
this.updateStatus$ = this.store.pipe(select(updateEmbeddedAppStatus));
this._updateSubscription = this.actions$.pipe(
ofType(BackendsActionTypes.UPDATE_EMBEDDED_APP_COMPLETE),
).subscribe(() => this.router.navigate([ '..' ], { relativeTo: this.route }));
}
开发者ID:our-city-app,项目名称:plugin-mobicage-control-center,代码行数:9,代码来源:update-embedded-app-page.component.ts
示例6: logout
@Effect({ dispatch: false })
logout(): Observable<Action> {
return this.actions$.ofType(AuthActionTypes.LOGOUT).pipe(
tap(action => {
this.router.navigate(['']);
this.localStorageService.setItem(AUTH_KEY, { isAuthenticated: false });
})
);
}
示例7: persistTodos
@Effect({ dispatch: false })
persistTodos(): Observable<Action> {
return this.actions$
.ofType(TodosActionTypes.PERSIST)
.pipe(
tap((action: ActionTodosPersist) =>
this.localStorageService.setItem(TODOS_KEY, action.payload.todos)
)
);
}
示例8: persistThemeSettings
@Effect({ dispatch: false })
persistThemeSettings(): Observable<Action> {
return this.actions$.ofType(SETTINGS_CHANGE_THEME).pipe(
tap(action =>
this.localStorageService.setItem(SETTINGS_KEY, {
theme: action.payload
})
)
);
}
示例9: login
@Effect({ dispatch: false })
login(): Observable<Action> {
return this.actions$
.ofType(AuthActionTypes.LOGIN)
.pipe(
tap(action =>
this.localStorageService.setItem(AUTH_KEY, { isAuthenticated: true })
)
);
}
示例10: logout
@Effect({ dispatch: false })
logout() {
return this.actions$.pipe(
ofType<ActionAuthLogout>(AuthActionTypes.LOGOUT),
tap(() => {
this.router.navigate(['']);
this.localStorageService.setItem(AUTH_KEY, { isAuthenticated: false });
})
);
}