Skip to content

Commit

Permalink
feat(cart-customer): create injection tokens with factory (#3236)
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 authored Oct 14, 2024
1 parent f96294f commit b07ab07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { InjectionToken } from '@angular/core';

import { createSingleInjectionToken } from '@daffodil/core';
import { daffTransformErrorToStateError } from '@daffodil/core/state';

/**
* Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
* Can be used to further refine Daffodil errors into more specific app errors.
*/
export const DAFF_CART_CUSTOMER_ERROR_MATCHER = new InjectionToken<typeof daffTransformErrorToStateError>(
export const {
/**
* Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
* Can be used to further refine Daffodil errors into more specific app errors.
*/
token: DAFF_CART_CUSTOMER_ERROR_MATCHER,
provider: daffProvideCartCustomerErrorMatcher,
} = createSingleInjectionToken<typeof daffTransformErrorToStateError>(
'DAFF_CART_CUSTOMER_ERROR_MATCHER',
{ factory: () => daffTransformErrorToStateError },
);
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { DAFF_CART_CUSTOMER_ERROR_MATCHER } from './error-matcher.token';
export * from './error-matcher.token';

0 comments on commit b07ab07

Please sign in to comment.