import { Context } from '@vue-storefront/core' ; import { Currency } from '@vue-storefront/magento-api' ; import { useCurrencyFactory , UseCurrencyFactoryParams } from '../../factories/useCurrencyFactory' ; import { UseCurrency } from '../../types/composables' ; const factoryParams = { load : async ( context , params ) : Promise < Currency > => { const { data } = await context . $magento . api . currency ( ) ; return data . currency || { } ; } , change : ( context , params ) => { context . $magento . config . state . setCurrency ( params . id ) ; } , } ; const useCurrency = useCurrencyFactory < Currency > ( factoryParams ) ; export default useCurrency ;