Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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
) {}
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$'))
)
)
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 {}
}
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;
}
}