@@ -275,10 +275,6 @@ import {
275275 SfSelect ,
276276 SfCheckbox ,
277277} from ' @storefront-ui/vue' ;
278- import {
279- useCountrySearch ,
280- addressGetter ,
281- } from ' @vue-storefront/magento' ;
282278import { ValidationProvider , ValidationObserver , extend } from ' vee-validate' ;
283279import { required , min , digits } from ' vee-validate/dist/rules' ;
284280import {
@@ -290,9 +286,9 @@ import {
290286 defineComponent ,
291287 useContext ,
292288} from ' @nuxtjs/composition-api' ;
293- import { userBillingGetters } from ' ~/getters' ;
289+ import { userBillingGetters , addressGetter } from ' ~/getters' ;
294290import {
295- useShipping , useUser , useBilling , useUserAddress ,
291+ useShipping , useUser , useBilling , useUserAddress , useCountrySearch ,
296292} from ' ~/composables' ;
297293import UserAddressDetails from ' ~/components/UserAddressDetails.vue' ;
298294import {
@@ -349,10 +345,10 @@ export default defineComponent({
349345 } = useShipping ();
350346 const {
351347 load: loadCountries ,
352- countries ,
353348 search: searchCountry ,
354- country ,
355- } = useCountrySearch (' Step:Billing' );
349+ } = useCountrySearch ();
350+ const countries = ref ([]);
351+ const country = ref (null );
356352 const { isAuthenticated } = useUser ();
357353 let oldBilling = null ;
358354 const sameAsShipping = ref (false );
@@ -412,21 +408,21 @@ export default defineComponent({
412408 sameAsShipping .value = ! sameAsShipping .value ;
413409 if (sameAsShipping .value ) {
414410 shippingDetails .value = await loadShipping ();
415- await searchCountry ({ id: shippingDetails .value .country_code });
411+ country . value = await searchCountry ({ id: shippingDetails .value .country_code });
416412 oldBilling = { ... billingDetails .value };
417413 billingDetails .value = {
418414 ... formatAddressReturnToData (shippingDetails .value ),
419415 };
420416 currentAddressId .value = NOT_SELECTED_ADDRESS ;
421417 setAsDefault .value = false ;
422418 if (billingDetails .value .country_code ) {
423- await searchCountry ({ id: billingDetails? .value .country_code });
419+ country . value = await searchCountry ({ id: billingDetails? .value .country_code });
424420 }
425421 return ;
426422 }
427423 billingDetails .value = oldBilling;
428424 if (billingDetails .value .country_code ) {
429- await searchCountry ({ id: billingDetails? .value .country_code });
425+ country . value = await searchCountry ({ id: billingDetails? .value .country_code });
430426 }
431427 };
432428
@@ -465,7 +461,7 @@ export default defineComponent({
465461
466462 const changeCountry = async (id ) => {
467463 changeBillingDetails (' country_code' , id);
468- await searchCountry ({ id });
464+ country . value = await searchCountry ({ id });
469465 };
470466
471467 watch (billingAddress, (addr ) => {
@@ -478,10 +474,11 @@ export default defineComponent({
478474 await router .push (app .localePath (' /checkout/user-account' ));
479475 }
480476
481- const [loadedBilling ] = await Promise .all ([load (), loadCountries ()]);
477+ const [loadedBilling , loadedCountries ] = await Promise .all ([load (), loadCountries ()]);
482478 billingAddress .value = loadedBilling;
479+ countries .value = loadedCountries;
483480 if (billingDetails .value ? .country_code ) {
484- await searchCountry ({ id: billingDetails .value .country_code });
481+ country . value = await searchCountry ({ id: billingDetails .value .country_code });
485482 }
486483
487484 if (! userBilling .value ? .addresses && isAuthenticated .value ) {
0 commit comments