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'));
  }
 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));
 }
Example #3
0
 @Effect({ dispatch: false })
 persistTodos() {
   return this.actions$.pipe(
     ofType<ActionTodosPersist>(TodosActionTypes.PERSIST),
     tap(action =>
       this.localStorageService.setItem(TODOS_KEY, action.payload.todos)
     )
   );
 }
Example #4
0
 @Effect({ dispatch: false })
 login() {
   return this.actions$.pipe(
     ofType<ActionAuthLogin>(AuthActionTypes.LOGIN),
     tap(() =>
       this.localStorageService.setItem(AUTH_KEY, { isAuthenticated: true })
     )
   );
 }
 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 }));
 }
 @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 });
     })
   );
 }
 @Effect({ dispatch: false })
 persistTodos(): Observable<Action> {
   return this.actions$
     .ofType(TodosActionTypes.PERSIST)
     .pipe(
       tap((action: ActionTodosPersist) =>
         this.localStorageService.setItem(TODOS_KEY, action.payload.todos)
       )
     );
 }
Example #8
0
 @Effect({ dispatch: false })
 persistThemeSettings(): Observable<Action> {
   return this.actions$.ofType(SETTINGS_CHANGE_THEME).pipe(
     tap(action =>
       this.localStorageService.setItem(SETTINGS_KEY, {
         theme: action.payload
       })
     )
   );
 }
 @Effect({ dispatch: false })
 login(): Observable<Action> {
   return this.actions$
     .ofType(AuthActionTypes.LOGIN)
     .pipe(
       tap(action =>
         this.localStorageService.setItem(AUTH_KEY, { isAuthenticated: true })
       )
     );
 }
Example #10
0
 @Effect({ dispatch: false })
 logout() {
   return this.actions$.pipe(
     ofType<ActionAuthLogout>(AuthActionTypes.LOGOUT),
     tap(() => {
       this.router.navigate(['']);
       this.localStorageService.setItem(AUTH_KEY, { isAuthenticated: false });
     })
   );
 }