Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 128x 128x 128x 128x 128x 128x 128x 128x 1x 6x 1x | import { EntityState, createEntityAdapter } from '@ngrx/entity'; import { createReducer, on } from '@ngrx/store'; import { Address } from 'ish-core/models/address/address.model'; import { HttpError } from 'ish-core/models/http-error/http-error.model'; import { deleteBasketShippingAddress, updateBasketAddress } from 'ish-core/store/customer/basket'; import { setErrorOn, setLoadingOn, unsetLoadingAndErrorOn } from 'ish-core/utils/ngrx-creators'; import { createCustomerAddress, createCustomerAddressFail, createCustomerAddressSuccess, deleteCustomerAddress, deleteCustomerAddressFail, deleteCustomerAddressSuccess, loadAddresses, loadAddressesFail, loadAddressesSuccess, updateCustomerAddress, updateCustomerAddressFail, updateCustomerAddressSuccess, } from './addresses.actions'; export const addressAdapter = createEntityAdapter<Address>({}); export interface AddressesState extends EntityState<Address> { loading: boolean; error: HttpError; } const initialState: AddressesState = addressAdapter.getInitialState({ loading: false, error: undefined, }); export const addressesReducer = createReducer( initialState, setLoadingOn( loadAddresses, createCustomerAddress, updateCustomerAddress, updateBasketAddress, deleteCustomerAddress, deleteBasketShippingAddress ), setErrorOn(loadAddressesFail, createCustomerAddressFail, updateCustomerAddressFail, deleteCustomerAddressFail), unsetLoadingAndErrorOn( loadAddressesSuccess, createCustomerAddressSuccess, updateCustomerAddressSuccess, deleteCustomerAddressSuccess ), on(loadAddressesSuccess, (state, action) => addressAdapter.setAll(action.payload.addresses, state)), on(createCustomerAddressSuccess, updateCustomerAddressSuccess, (state, action) => addressAdapter.upsertOne(action.payload.address, state) ), on(deleteCustomerAddressSuccess, (state, action) => addressAdapter.removeOne(action.payload.addressId, state)) ); |