How to use the @spartacus/core.AuthActions.LOGIN function in @spartacus/core

To help you get started, we’ve selected a few @spartacus/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / cloud-commerce-spartacus-storefront / projects / cds / src / profiletag / services / spartacus-events.spec.ts View on Github external
it(`Should call the push method first time a login is successful`, () => {
    let timesCalled = 0;
    const subscription = spartacusEventTracker
      .loginSuccessful()
      .pipe(tap(_ => timesCalled++))
      .subscribe();
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    subscription.unsubscribe();
    expect(timesCalled).toEqual(2);
  });
});
github SAP / cloud-commerce-spartacus-storefront / projects / cds / src / profiletag / services / spartacus-events.spec.ts View on Github external
it(`Should call the push method first time a login is successful`, () => {
    let timesCalled = 0;
    const subscription = spartacusEventTracker
      .loginSuccessful()
      .pipe(tap(_ => timesCalled++))
      .subscribe();
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGIN });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    mockActionsSubject.next({ type: AuthActions.LOGOUT });
    subscription.unsubscribe();
    expect(timesCalled).toEqual(2);
  });
});
github SAP / cloud-commerce-spartacus-storefront / projects / incubator / src / eventsystem / auth / auth-event.builder.ts View on Github external
buildLoginEvent(): Observable {
    return this.create([AuthActions.LOGIN]).pipe(
      mapTo(true),
      distinctUntilChanged()
    );
  }
github SAP / cloud-commerce-spartacus-storefront / projects / cds / src / profiletag / services / spartacus-events.ts View on Github external
action =>
          action.type === AuthActions.LOGIN ||
          action.type === AuthActions.LOGOUT
      ),