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

Integrated basic info with API#236

Open
defudef wants to merge 16 commits into
masterfrom
feature/224-my-account-api-integration
Open

Integrated basic info with API#236
defudef wants to merge 16 commits into
masterfrom
feature/224-my-account-api-integration

Conversation

@defudef
Copy link
Copy Markdown
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
Copy Markdown
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
Comment thread packages/commercetools/api-client/src/api/getMe/defaultQuery.ts
Comment thread packages/commercetools/api-client/src/api/getMe/defaultQuery.ts
Comment thread packages/core/theme-module/theme/pages/MyAccount.vue Outdated
Comment thread packages/core/theme-module/theme/pages/MyAccount/ShippingDetails.vue Outdated
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 16, 2020

CLA assistant check
All committers have signed the CLA.

Comment thread packages/commercetools/composables/src/useUser/index.ts Outdated
Comment thread packages/commercetools/composables/src/useUserAddress/index.ts Outdated
Comment thread packages/core/theme-module/theme/pages/MyAccount.vue Outdated
Comment thread packages/core/theme-module/theme/pages/MyAccount/ShippingDetails.vue Outdated
Comment thread packages/commercetools/composables/src/useUser/index.ts Outdated
Comment thread packages/core/factories/src/useUserAddressFactory.ts Outdated
Comment thread packages/core/factories/src/useUserAddressFactory.ts Outdated
Comment thread packages/core/factories/src/useUserAddressFactory.ts
Comment thread packages/core/interfaces/src/index.ts Outdated
@defudef defudef requested a review from Qrzy March 31, 2020 06:24
@defudef defudef requested review from filrak and patzick March 31, 2020 06:24
@defudef defudef linked an issue Mar 31, 2020 that may be closed by this pull request
Copy link
Copy Markdown
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

Comment thread packages/commercetools/composables/src/useUser/factoryParams.ts
Comment thread packages/commercetools/composables/src/useUserAddress/index.ts
Comment thread packages/core/factories/__tests__/useUserAddress.spec.ts
Comment thread packages/core/factories/__tests__/useUserAddress.spec.ts
Comment thread packages/core/factories/src/useUserAddressFactory.ts
Comment thread packages/core/factories/src/useUserAddressFactory.ts
Copy link
Copy Markdown
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
Copy Markdown
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';

import useCart from '../useCart';

export const params: UseUserFactoryParams<Customer, any, any> = {
export type UpdateUserParams = Customer & { clientSideOnly?: boolean };
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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