Skip to content

Commit

Permalink
feat: #49 (*) run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Baroshem committed Aug 22, 2021
1 parent 5f52511 commit 423c6e6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/composables/__tests__/mocks/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './mockedCollectionList';
export * from './mockedProduct';
export * from './mockedCart';
export * from './mockedShipping';
export * from './mockedShipping';
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jest.mock('@vue-storefront/core', () => ({
const context = {
$vendure: {
api: {
getShippingMethods: jest.fn(() => Promise.resolve({ data: { eligibleShippingMethods: mockedShippingMethods }}))
getShippingMethods: jest.fn(() => Promise.resolve({ data: { eligibleShippingMethods: mockedShippingMethods }}))
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/components/Checkout/CartPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default {
props: {
selectedShippingMethod: {
type: Object,
required: false,
required: false
}
},
setup (props) {
Expand All @@ -107,7 +107,7 @@ export default {
const discounts = computed(() => cartGetters.getDiscounts(cart.value));
const shippingCost = computed(() => getCalculatedPrice(cart?.value?.shipping));
watch(() => props.selectedShippingMethod, async (newVal, oldVal) => {
watch(() => props.selectedShippingMethod, async () => {
await load();
});
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/components/Checkout/VsfShippingProvider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ export default {
loading: loadingShippingProvider
} = useShippingProvider();
const totals = computed(() => cartGetters.getTotals(cart.value));
const selectedShippingMethod = ref(null)
const selectedShippingMethod = ref(null);
const error = reactive({
loadMethods: null
});
const selectShippingMethod = async shippingMethod => {
const newOrder = await $vendure.api.setShippingMethod({ shippingMethodId: shippingMethod.id })
const newOrder = await $vendure.api.setShippingMethod({ shippingMethodId: shippingMethod.id });
setCart(newOrder.data.setOrderShippingMethod);
selectedShippingMethod.value = shippingMethod;
emit('shippingMethodSelected', shippingMethod);
Expand Down
12 changes: 6 additions & 6 deletions packages/theme/helpers/shipping-billing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OrderAddress } from "~/../api-client/lib";
import { COUNTRIES } from "./constants";
import { OrderAddress } from '~/../api-client/lib';
import { COUNTRIES } from './constants';

interface AddressForm {
firstName: string,
Expand All @@ -19,7 +19,7 @@ export const mapAddressFormToOrderAddress = (addressForm: AddressForm): OrderAdd
city: addressForm.city,
postalCode: addressForm.postalCode,
countryCode: addressForm.country,
phoneNumber: addressForm.phone,
phoneNumber: addressForm.phone
});

export const mapOrderAddressToAddressForm = (orderAddress: OrderAddress): AddressForm => {
Expand All @@ -36,11 +36,11 @@ export const mapOrderAddressToAddressForm = (orderAddress: OrderAddress): Addres
country: country?.key,
postalCode: orderAddress?.postalCode,
phone: orderAddress?.phoneNumber
}
}
};
};

export const getCalculatedPrice = (price: number): number => {
if (!price) return;

return price / 100;
}
};
2 changes: 1 addition & 1 deletion packages/theme/pages/Checkout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
const updateShippingInCartPreview = (shippingMethod) => {
selectedShippingMethod.value = shippingMethod;
}
};
return {
handleStepClick,
Expand Down
1 change: 0 additions & 1 deletion packages/theme/pages/Checkout/Billing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ export default {
billingDetails.value = mapOrderAddressToAddressForm(oldBilling);
};
const form = ref({
firstName: '',
lastName: '',
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/pages/Checkout/Shipping.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ export default {
};
const displayBillingButton = async () => {
shouldDisplayButton.value = true
shouldDisplayButton.value = true;
emit('shippingMethodSelected');
}
};
onSSR(async () => {
await load();
Expand Down

0 comments on commit 423c6e6

Please sign in to comment.