GitHub

DaffCartDriverResolveService

A service for resolving the cart in a way that is tolerant of errors and invalid or missing cart IDs in storage.

import { DaffCartDriverResolveService } from '@daffodil/cart/driver'
@Injectable()
class DaffCartDriverResolveService<<T extends DaffCart = DaffCart>>  {
  getCartOrFail(): Observable<DaffDriverResponse<T>>
  getCartIdOrFail(): Observable<DaffCart['id']>
}

Properties

Name Type Description
getCartOrFail Observable<DaffDriverResponse<T>>

Resolves the cart, creating if no ID is in storage. If the cart cannot be found, removes the ID from storage. If the cart cannot be resolved, throws an error.

getCartIdOrFail Observable<DaffCart['id']>

Retrieves the cart ID, creating if no ID is in storage.