You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,6 +181,34 @@ Note that `useStorefrontData` automatically extracts the `data` property from th
181
181
stringify.
182
182
When using it together with the setting `errors: { throw: false }` you will need to check for errors manually within the response instead of using the `error` object returned by the `useStorefrontData` composable.
183
183
184
+
### Access Customer Account API on the client side
185
+
186
+
First check out the [Customer Account API documentation](https://shopify.nuxtjs.org/essentials/customer-account) to set up dependencies and add credentials.
187
+
188
+
Then you can access the Customer Account API on the client side with the `useCustomerAccount` composable:
189
+
190
+
```html
191
+
<!-- ~/pages/your-page.vue -->
192
+
193
+
<scriptsetuplang="ts">
194
+
constcustomerAccount=useCustomerAccount()
195
+
196
+
const { data } =awaitcustomerAccount.request(`#graphql
197
+
query {
198
+
customer {
199
+
id
200
+
firstName
201
+
lastName
202
+
}
203
+
}
204
+
`)
205
+
</script>
206
+
207
+
<template>
208
+
<pre>{{ data?.customer }}</pre>
209
+
</template>
210
+
```
211
+
184
212
### Access APIs via Nitro endpoints
185
213
186
214
The module exposes utilities to access each API via Nitro endpoints.
0 commit comments