This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { select, Store } from '@ngrx/store'; | |
import { Observable } from 'rxjs'; | |
import { ErrorDto } from '@models/error'; | |
import { | |
Auth, | |
CreateLoginDto, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ActionReducerMap } from '@ngrx/store'; | |
import { | |
userAddressesReducer, | |
UserAddressesState | |
} from './user-addresses.reducer'; | |
import { userProfileReducer, UserProfileState } from './user-profile.reducer'; | |
export interface UserState { | |
addresses: UserAddressesState; | |
profile: UserProfileState; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { combineReducers } from '@ngrx/store'; | |
import { | |
userAddressesReducer, | |
UserAddressesState, | |
initialUserAddressesState | |
} from './user-addresses.reducer'; | |
import { | |
userProfileReducer, | |
UserProfileState, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postAccountUpdateProducts( | |
products: MarketAccountUpdateProductDto[] | |
): Observable<MarketAccountCompleteDto | null> { | |
return this.facade.data$.pipe( | |
switchMap((dto: MarketAccountCompleteDto | null) => { | |
if (dto) { | |
const data: MarketAccountUpdateProductsDto = { | |
user: dto.account, | |
products | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE | |
createForm() { | |
this.frm = this.fb.group({ | |
delivery: this.delivery, | |
invoice: this.invoice | |
}); | |
this.frm.get('invoice').disable(); | |
} | |
show() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkStore(): Observable<boolean> { | |
return this.store.select(fromStore.selectDishesLoaded).pipe( | |
tap(loaded => { | |
if (!loaded) { | |
this.store.dispatch(new fromStore.LoadDishes()); | |
} | |
}), | |
take(1) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export abstract class BaseComponent implements OnDestroy { | |
private subscriptions: Array<Subscription> = []; | |
ngOnDestroy() { | |
this.subscriptions.forEach(sub => sub.unsubscribe()); | |
} | |
public subscription(subscription: Subscription) { | |
this.subscriptions.push(subscription); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function ifExists<T>(obj: T | null | undefined, callback: (obj: T) => void) { | |
if (exists(obj)) { | |
callback(obj as T); | |
} | |
} | |
addCurrency(currencyType: Currency, amount: number) { | |
obj.ifExists(this.model, (dto) => { | |
for (const currency of dto.currency) { | |
if (currency.first === currencyType) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { TranslateService, LangChangeEvent } from '@ngx-translate/core'; | |
import { Logger } from '../logger'; | |
import enUS from '../../../translations/en-US.json'; | |
import itIT from '../../../translations/it-IT.json'; | |
const log = new Logger('I18nService'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { graphql } from "gatsby" | |
import Img from "gatsby-image" | |
const Image = ({ data }) => ( | |
<div> | |
<h1>Hello gatsby-image</h1> | |
{console.log(data)} | |
<Img fluid={data.file.childImageSharp.fluid} /> | |
</div> |