From 3e7bc9a9e77a913a497117563549272eeab2ef8b Mon Sep 17 00:00:00 2001 From: Paulo Margarido <64600052+paulomarg@users.noreply.github.com> Date: Tue, 1 Aug 2023 14:01:18 -0400 Subject: [PATCH] Fix documentation on getOfflineId method --- .changeset/metal-needles-share.md | 2 ++ docs/guides/webhooks.md | 4 ++-- docs/reference/session/getOfflineId.md | 2 +- docs/reference/webhooks/addHandlers.md | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .changeset/metal-needles-share.md diff --git a/.changeset/metal-needles-share.md b/.changeset/metal-needles-share.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/metal-needles-share.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/docs/guides/webhooks.md b/docs/guides/webhooks.md index 6bfa4e577..dc352d984 100644 --- a/docs/guides/webhooks.md +++ b/docs/guides/webhooks.md @@ -71,7 +71,7 @@ app.post('/webhooks', express.text({type: '*/*'}), async (req, res) => { console.log(`Received webhook for ${topic} for shop ${domain}`); - const sessionId = shopify.session.getOfflineId({shop: domain}); + const sessionId = shopify.session.getOfflineId(domain); // Run your webhook-processing code here! }); @@ -87,7 +87,7 @@ const handleWebhookRequest = async ( webhookId: string, apiVersion: string, ) => { - const sessionId = shopify.session.getOfflineId({shop}); + const sessionId = shopify.session.getOfflineId(shop); // Run your webhook-processing code here! }; diff --git a/docs/reference/session/getOfflineId.md b/docs/reference/session/getOfflineId.md index 5fb789613..5ec06b6d7 100644 --- a/docs/reference/session/getOfflineId.md +++ b/docs/reference/session/getOfflineId.md @@ -9,7 +9,7 @@ You should **_never_** read the shop from user inputs or URLs. ```ts async function myWebhookHandler(topic, shop) { - const offlineSessionId = await shopify.session.getOfflineId({shop}); + const offlineSessionId = await shopify.session.getOfflineId(shop); // use sessionId to retrieve session from app's session storage // getSessionFromStorage() must be provided by application diff --git a/docs/reference/webhooks/addHandlers.md b/docs/reference/webhooks/addHandlers.md index f67353769..2c288c1b5 100644 --- a/docs/reference/webhooks/addHandlers.md +++ b/docs/reference/webhooks/addHandlers.md @@ -21,7 +21,7 @@ const handleWebhookRequest = async ( webhookId: string, apiVersion: string, ) => { - const sessionId = shopify.session.getOfflineId({shop}); + const sessionId = shopify.session.getOfflineId(shop); // Fetch the session from storage and process the webhook event };