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 {}
}
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();
}
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));
}
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
);
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
);
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
);
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);
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);