Skip to content
This repository has been archived by the owner on May 21, 2020. It is now read-only.

Integrated basic info with API #236

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

defudef
Copy link
Contributor

@defudef defudef commented Mar 6, 2020

  • I can see personal data on my account page
  • I can see all my addresses from CT
  • I can see which address is masked for shipment and which one is for billing
  • I want to see my email address on password change subpage
  • Refactor MyAccount.vue (using setup instead of data and methods)
  • Refactor ShippingDetails.vue (using setup instead of data and methods)
  • Unit tests

@defudef defudef changed the title Integrated basic info with API [WIP] Integrated basic info with API Mar 6, 2020
@defudef defudef changed the title [WIP] Integrated basic info with API Integrated basic info with API Mar 6, 2020
@defudef defudef self-assigned this Mar 6, 2020
@defudef
Copy link
Contributor Author

defudef commented Mar 6, 2020

related #224

@defudef defudef linked an issue Mar 6, 2020 that may be closed by this pull request
4 tasks
@CLAassistant
Copy link

CLAassistant commented Mar 16, 2020

CLA assistant check
All committers have signed the CLA.

packages/core/theme-module/theme/pages/MyAccount.vue Outdated Show resolved Hide resolved
packages/commercetools/composables/src/useUser/index.ts Outdated Show resolved Hide resolved
packages/core/factories/src/useUserAddressFactory.ts Outdated Show resolved Hide resolved
packages/core/factories/src/useUserAddressFactory.ts Outdated Show resolved Hide resolved
packages/core/factories/src/useUserAddressFactory.ts Outdated Show resolved Hide resolved
packages/core/interfaces/src/index.ts Outdated Show resolved Hide resolved
@defudef defudef requested a review from Qrzy March 31, 2020 06:24
@defudef defudef requested review from patzick and filrak March 31, 2020 06:24
@defudef defudef linked an issue Mar 31, 2020 that may be closed by this pull request
Copy link
Collaborator

@andrzejewsky andrzejewsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, but I think it may require an RFC

Copy link
Contributor

@patzick patzick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes from packages/core/ need to be proposed first as RFC and then after discussion can be further implemented

@patzick patzick removed the RFC label Apr 1, 2020
import {UseUserFactoryParams} from '@vue-storefront/factories';
import {Customer} from '@vue-storefront/commercetools-api/lib//types/GraphQL';
import { UseUserFactoryParams } from '@vue-storefront/factories';
import { Customer } from '@vue-storefront/commercetools-api/lib//types/GraphQL';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { Customer } from '@vue-storefront/commercetools-api/lib//types/GraphQL';
import { Customer } from '@vue-storefront/commercetools-api/lib/types/GraphQL';

@@ -10,7 +11,9 @@ import {
} from '@vue-storefront/commercetools-api';
import useCart from '../useCart';

export const params: UseUserFactoryParams<Customer, any, any> = {
export type UpdateUserParams = Customer & { clientSideOnly?: boolean };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate more on that?


export const params: UseUserAddressFactoryParams<Customer, Address, UserAddressType, { [x: string]: any }, UpdateUserParams> = {
userComposable,
addresses: userComposable.user.value && userComposable.user.value.id ? userComposable.user.value.addresses : [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user is a computed, readonly property, you can't assign anything to it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to partailly implement #342 for useUser

const loading: Ref<boolean> = ref(false);

const updateData = async (data: UpdatedUserAddresses<ADDRESS, UPDATE_USER_PARAMS>) => {
factoryParams.addresses.length = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

SEARCH_PARAMS = { [x: string]: any },
UPDATE_USER_PARAMS = any,
> = {
addresses: ADDRESS[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you need to explicitly pass those addresses? Shouldn't that be loaded by searchAddresses ?

addAddress,
updateAddress,
deleteAddress,
getBillingAddresses,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this and getShippingAddresses is not a part of a public interface, it could be a getter or computed property or a field within addresses (to be discussed via RFC) but definitely not a public function. It's also not following architectural approach for compostable https://vsf-next-docs.netlify.com/commercetools/composables.html

root.$router.push(`/my-account/${title.toLowerCase().replace(' ', '-')}`);
};

const account = computed(() => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you can't just pass account and avoid additional code while its not doing anything meaningful?

? account.getShippingAddresses().find(shippingAddress => id === shippingAddress.id)
: {};

formType.value = id === null ? 'CREATE' : 'UPDATE';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why you need that?

@@ -1,18 +1,18 @@
<template>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally this file is not easily readable, please think about cleaning it up

@@ -0,0 +1,97 @@
import { UseUserAddress, UserAddressType, UseUser } from '@vue-storefront/interfaces';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please work on readability of this code, it's really hard to get some things

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I want to change My Personal Details I want to see my basic user information after I enter My Account
6 participants