-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Gets user's saved location if logged in and uses in session #2739
base: feat/delivery-promise
Are you sure you want to change the base?
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
884aac3
to
942ecf6
Compare
packages/api/src/platforms/vtex/clients/profile/types/ProfileAddress.ts
Outdated
Show resolved
Hide resolved
const addresses = await profile.addresses(userId) | ||
|
||
function mapAddressesToList(AddressesObj: any): ProfileAddress[] { | ||
if (!addresses || Object.keys(addresses).length === 0) { | ||
return [] | ||
} | ||
|
||
return Object.values<string>(AddressesObj).map( | ||
(stringifiedObj) => JSON.parse(stringifiedObj) as ProfileAddress | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: addresses
is already of type ProfileAddress[]
, I didn't get it why you considered as any
at line 345. What is the shape of ProfileAddress[]
incoming from API?
What's the purpose of this pull request?
This PR implements the scenario where the user is logged in, and when the user's saved location (address and geo-coordinates) is available, it is saved in the current session.
How it works?
How to test it?
First, we will need to simulate user logged. (you can follow this docs steps with more detail or follow the steps below)
person
object with user's information (that was previouslynull
)postalCode
andgeoCoordinates
in the sessionStarters Deploy Preview
vtex-sites/starter.store#731
Jira Task