@ngrx/effects#Actions TypeScript Examples

The following examples show how to use @ngrx/effects#Actions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: settings.effects.ts    From enterprise-ng-2020-workshop with MIT License 6 votes vote down vote up
constructor(
    private actions$: Actions,
    private store: Store<State>,
    private router: Router,
    private overlayContainer: OverlayContainer,
    private localStorageService: LocalStorageService,
    private titleService: TitleService,
    private animationsService: AnimationsService,
    private translateService: TranslateService,
    private ngZone: NgZone
  ) {}
Example #2
Source File: lists.effect.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
constructor(
    private actions$: Actions,
    private authApi: ListsService,
    private appState$: Store<store.AppState>,
    public snackBar: MatSnackBar,
    public title: Title,
    private meta: Meta,
    @Inject(PLATFORM_ID) private platformId: Object
  ) {}
Example #3
Source File: file-explorer.effects.ts    From nica-os with MIT License 5 votes vote down vote up
constructor(
    private store$: Store<FileExplorerState>,
    private actions$: Actions
  ) {}
Example #4
Source File: app.effects.ts    From Angular-Cookbook with MIT License 5 votes vote down vote up
constructor(
    private actions$: Actions,
    private userService: UserService
  ) {}
Example #5
Source File: auth.effects.ts    From router with MIT License 5 votes vote down vote up
constructor(
    private actions$: Actions,
    private authService: AuthService,
    private dialog: MatDialog
  ) {}
Example #6
Source File: member.effects.ts    From dating-client with MIT License 5 votes vote down vote up
constructor(private actions$: Actions, private memberService: MemberService) {}
Example #7
Source File: mdview.effects.ts    From geonetwork-ui with GNU General Public License v2.0 5 votes vote down vote up
constructor(
    private actions$: Actions,
    private searchService: SearchApiService,
    private esService: ElasticsearchService,
    private esMapper: ElasticsearchMapper
  ) {}
Example #8
Source File: app.effects.ts    From wingsearch with GNU General Public License v3.0 5 votes vote down vote up
constructor(
        private actions$: Actions,
        private cookies: CookiesService,
        private http: HttpClient
    ) { }
Example #9
Source File: hydration.effects.ts    From ngrx-issue-tracker with MIT License 5 votes vote down vote up
constructor(private action$: Actions, private store: Store<RootState>) {}
Example #10
Source File: projects.effects.ts    From nuxx with GNU Affero General Public License v3.0 5 votes vote down vote up
constructor(private actions$: Actions, private restService: RestService, private store: Store<AppState>, private location: Location, private eventEmitterService: EventEmitterService, private router: Router) {}
Example #11
Source File: notification.effects.ts    From digital-bank-ui with Mozilla Public License 2.0 5 votes vote down vote up
constructor(private actions$: Actions, private notificationService: NotificationService) {}
Example #12
Source File: auth.effects.spec.ts    From enterprise-ng-2020-workshop with MIT License 5 votes vote down vote up
describe('AuthEffects', () => {
  let localStorageService: jasmine.SpyObj<LocalStorageService>;
  let router: jasmine.SpyObj<Router>;

  beforeEach(() => {
    localStorageService = jasmine.createSpyObj('LocalStorageService', [
      'setItem'
    ]);
    router = jasmine.createSpyObj('Router', ['navigateByUrl']);
  });

  describe('login', () => {
    it('should not dispatch any action', () => {
      const actions = new Actions(EMPTY);
      const effect = new AuthEffects(actions, localStorageService, router);
      const metadata = getEffectsMetadata(effect);

      expect(metadata.login.dispatch).toEqual(false);
    });

    it('should call setItem on LocalStorageService', () => {
      scheduler.run((helpers) => {
        const { cold } = helpers;
        const loginAction = authLogin();
        const source = cold('a', { a: loginAction });
        const actions = new Actions(source);
        const effect = new AuthEffects(actions, localStorageService, router);

        effect.login.subscribe(() => {
          expect(localStorageService.setItem).toHaveBeenCalledWith(AUTH_KEY, {
            isAuthenticated: true
          });
        });
      });
    });
  });

  describe('logout', () => {
    it('should not dispatch any action', () => {
      const actions = new Actions(EMPTY);
      const effect = new AuthEffects(actions, localStorageService, router);
      const metadata = getEffectsMetadata(effect);

      expect(metadata.logout.dispatch).toEqual(false);
    });

    it('should call setItem on LocalStorageService and navigate to about', () => {
      scheduler.run((helpers) => {
        const { cold } = helpers;
        const logoutAction = authLogout();
        const source = cold('a', { a: logoutAction });
        const actions = new Actions(source);
        const effect = new AuthEffects(actions, localStorageService, router);

        effect.login.subscribe(() => {
          expect(localStorageService.setItem).toHaveBeenCalledWith(AUTH_KEY, {
            isAuthenticated: false
          });
          expect(router.navigate).toHaveBeenCalledWith(['']);
        });
      });
    });
  });
});
Example #13
Source File: app.effects.ts    From youpez-admin with MIT License 5 votes vote down vote up
constructor(private actions$: Actions) {}
Example #14
Source File: trade-logs.effects.ts    From zorro-fire-log with MIT License 5 votes vote down vote up
constructor(
    private firestore: AngularFirestore,
    private store: Store<TradeLogState>,
    private actions$: Actions,
    @Inject(useMockData) private useMockData: boolean
  ) {}
Example #15
Source File: customer.effects.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
constructor(
    private action$: Actions,
    private Service: CustomersApiClientService
  ) {}