Skip to content
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

getCustomer() - Q/FR #120

Open
0dp opened this issue Jul 30, 2020 · 3 comments
Open

getCustomer() - Q/FR #120

0dp opened this issue Jul 30, 2020 · 3 comments

Comments

@0dp
Copy link

0dp commented Jul 30, 2020

Hi There

Any reason why stencil-utils does not feature a method to get current customer object or by id like getCustomer()
To me it seems appropriate, or am I missing something?

@junedkazi
Copy link
Contributor

@0dp can you please share the use case in which you would need to request the data periodically over an ajax request since the data already exists in the context across all pages and could be easily passed to the JS layer through the jsContext via inject.

@0dp
Copy link
Author

0dp commented Jul 30, 2020

Hi @junedkazi
I guess it would to avoid stuff like this

            fetch('/graphql', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    Authorization: `Bearer ${this.context.token}`,
                },
                body: JSON.stringify({
                    query: `
                    query CustomerAttributes {
                        customer {
                            ...
                            firstName,
                            ...
                        }
                    }
                    `,
                }),
            })

But maybe I'm missing something

@0dp
Copy link
Author

0dp commented Aug 1, 2020

Also I don't see information like customer addresses across all pages. I see the preferred shipping address. But mostly "addresses": is null

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

No branches or pull requests

2 participants