Integrated basic info with API#236
Conversation
|
related #224 |
…my-account-api-integration
…my-account-api-integration
…my-account-api-integration
andrzejewsky
left a comment
There was a problem hiding this comment.
Looks ok, but I think it may require an RFC
patzick
left a comment
There was a problem hiding this comment.
changes from packages/core/ need to be proposed first as RFC and then after discussion can be further implemented
| 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'; |
There was a problem hiding this comment.
| 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 }; |
There was a problem hiding this comment.
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 : [], |
There was a problem hiding this comment.
user is a computed, readonly property, you can't assign anything to it
There was a problem hiding this comment.
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; |
| SEARCH_PARAMS = { [x: string]: any }, | ||
| UPDATE_USER_PARAMS = any, | ||
| > = { | ||
| addresses: ADDRESS[]; |
There was a problem hiding this comment.
why you need to explicitly pass those addresses? Shouldn't that be loaded by searchAddresses ?
| addAddress, | ||
| updateAddress, | ||
| deleteAddress, | ||
| getBillingAddresses, |
There was a problem hiding this comment.
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(() => ({ |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
can you explain why you need that?
| @@ -1,18 +1,18 @@ | |||
| <template> | |||
There was a problem hiding this comment.
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'; | |||
There was a problem hiding this comment.
Please work on readability of this code, it's really hard to get some things

Uh oh!
There was an error while loading. Please reload this page.