How to use the routeshub.Secluded function in routeshub

To help you get started, we’ve selected a few routeshub 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 maktarsis / concept-store-platform / src / app / views / cart / containers / cart / cart.component.ts View on Github external
// tslint:disable-next-line:max-line-length
import { CartState, getCartApparel } from '+store/selectors/cart.selectors';
import { ClearApparel, RemoveApparel } from '+store/actions';
import { APP_UNIT_KEY, AppNotes } from '~app/hub/app.notes';

@Component({
  selector: 'cart-feat',
  templateUrl: './cart.component.html',
  styleUrls: ['./cart.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class CartComponent implements OnInit, OnDestroy {
  public cartApparels: Apparel[];
  public subtotal: number;

  @Secluded(APP_UNIT_KEY)
  private app: Unit;
  private unsubscribe$: Subject;

  private static calcSubtotal(apparels: Apparel[]): number {
    return apparels.reduce(
      (result: number, apparel: Apparel) => result + apparel.price,
      0
    );
  }

  constructor(
    private readonly apolloService: ApolloService,
    private readonly dialog: MatDialog,
    private readonly router: Router,
    private readonly store: Store
  ) {}
github maktarsis / concept-store-platform / src / app / core / store / effects / user.auth.effect.ts View on Github external
SignIn,
  SignInFailure,
  SignInSuccess,
  SignUp,
  SignUpCatchPhrase,
  SignUpCatchPhraseFailure,
  SignUpCatchPhraseSuccess,
  SignUpFailure,
  SignUpSuccess
} from '+store/actions/user.auth.action';
import { Go } from '+store/actions/router.action';
import { APP_UNIT_KEY, AppNotes } from '~app/hub/app.notes';

@Injectable({ providedIn: 'root' })
export class UserEffect {
  @Secluded(APP_UNIT_KEY)
  private appUnit: Unit;

  @Effect()
  public signUp$ = this.actions$.pipe(
    ofType(AuthActionTypes.SignUp),
    map((action: SignUp) => action.payload),
    switchMap((credentials: Access) =>
      this.apolloService.signUp(credentials).pipe(
        tap((user: User) => {
          AuthService.updateStorageUser({ token: user.id });
        }),
        map((user: User) => new SignUpSuccess(user)),
        catchError((error: Error) => of(new SignUpFailure(error))),
        finalize(() => console.log('finalize signUp$'))
      )
    )
github maktarsis / concept-store-platform / src / app / views / home / components / home-action / home-action.component.ts View on Github external
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';

import { Secluded, Unit } from 'routeshub';
import { SHOP_UNIT_KEY, ShopNotes } from '-shop/hub/shop.notes';

@Component({
  selector: 'home-action',
  templateUrl: './home-action.component.html',
  styleUrls: ['./home-action.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class HomeActionComponent implements OnInit {
  @Secluded(SHOP_UNIT_KEY)
  public shopUnit: Unit;

  public ngOnInit(): void {}
}
github maktarsis / concept-store-platform / src / app / views / shop / components / shop-bar / shop-bar.component.ts View on Github external
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';

import { Secluded, Unit } from 'routeshub';
import { SHOP_UNIT_KEY, ShopNotes } from '-shop/hub/shop.notes';

@Component({
  selector: 'shop-bar',
  templateUrl: './shop-bar.component.html',
  styleUrls: ['./shop-bar.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class ShopBarComponent {
  @Input() public categories: string[];

  @Secluded(SHOP_UNIT_KEY)
  public shopUnit: Unit;

  public identify(index: number): number {
    return index;
  }
}

routeshub

A route management library and pattern for Angular

MIT
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis