Created
September 5, 2024 15:50
-
-
Save jahilldev/1fc82dc01b711655b3702b8b7ec7904b to your computer and use it in GitHub Desktop.
Example Skio API Request (Hangs, Timeout)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const query = `#graphql | |
query getSubscriptions($email: String!) { | |
Subscriptions( | |
where: { | |
StorefrontUser: { email: { _eq: $email } } | |
}, | |
order_by: { createdAt: desc } | |
) { | |
id | |
platformId | |
createdAt | |
} | |
SubscriptionLines(where: { removedAt: { _is_null: true } }) { | |
priceWithoutDiscount | |
ProductVariant { | |
title | |
Product { | |
id | |
title | |
} | |
} | |
} | |
} | |
`; | |
const response = await fetch(API_URL, { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/graphql', | |
authorization: `API ${API_KEY}`, | |
}, | |
body: JSON.stringify({ query, variables: { email } }), | |
signal: AbortSignal.timeout(5000), | |
}); | |
const data = await response.json(); | |
console.log('response', { data }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment