How to use routeshub - 10 common examples

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 / core / components / header / header.component.ts View on Github external
public auth(): void {
    if (this.user && this.user.catchPhrase) {
      const state = forwardParams(this.hub.userCenter.id.state, {
        id: this.user.id
      });
      this.router.navigate(state).catch(console.error);

      return;
    }

    this.authPopUp();
  }
github maktarsis / concept-store-platform / src / app / core / components / header / header.component.ts View on Github external
public ngOnInit(): void {
    this.hub = getRegisteredUnits();
    this.isVisible = new BehaviorSubject(true);
    this.unsubscribe$ = new Subject();

    this.store
      .select(fromStore.getUser)
      .pipe(takeUntil(this.unsubscribe$))
      .subscribe((user: User) => (this.user = user));
  }
github maktarsis / concept-store-platform / src / app / views / location / hub / location.slice.ts View on Github external
import { createFeature, Slice } from 'routeshub';

import { appSlice } from '~app/routing/hub/app.slice';
import { locationNotes, LocationNotes as R } from './location.notes';

export const locationSlice: Slice = createFeature(
  appSlice.location,
  locationNotes
);
github maktarsis / routeshub / integration / app / routing / slices / bolid.slice.ts View on Github external
import { createFeature, Slice } from 'routeshub';

import { bolidRoutes, BolidRoutes } from '../notes';
import { appSlice } from './app.slice';

/**
 * Creates feature routes
 * through parent in the root
 */
export const bolidSlice: Slice = createFeature(
  appSlice.bolid,
  bolidRoutes
);
github maktarsis / concept-store-platform / src / app / views / user-center / hub / user-center.slice.ts View on Github external
import { createFeature, Slice } from 'routeshub';

import { appSlice } from '~app/routing/hub/app.slice';
import { userCenterNotes, UserCenterNotes as R } from './user-center.notes';

export const userCenterSlice: Slice = createFeature(
  appSlice.userCenter,
  userCenterNotes
);
github maktarsis / concept-store-platform / src / app / views / shop / hub / shop.slice.ts View on Github external
import { createFeature, Slice } from 'routeshub';

import { appSlice } from '~app/routing/hub/app.slice';
import { shopNotes, ShopNotes as R } from './shop.notes';

export const shopSlice: Slice = createFeature(appSlice.shop, shopNotes);
github maktarsis / routeshub / integration / app / routing / slices / automobile.slice.ts View on Github external
import { createFeature, Slice } from 'routeshub';

import { automobileRoutes, AutomobileRoutes } from '../notes';
import { appSlice } from './app.slice';

/**
 * Creates feature routes
 * through parent in the root
 */
export const automobileSlice: Slice = createFeature<
  AutomobileRoutes
>(appSlice.automobile, automobileRoutes);

routeshub

A route management library and pattern for Angular

MIT
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis