Posts yoScriptTagCheck
Post
Cancel

yoScriptTagCheck

yoScriptTagCheck

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { createClient, fetchExchange } from "urql";
import gql from "graphql-tag";

interface SCRIPTTAGCHECK {
    shop: string, 
    accessToken: number
}

export const getScriptTags = gql`
  query getScriptTags {
    scriptTags(first: 10) {
      edges {
        node {
          id
          src
        }
      }
    }
  }
`;

export const scriptTagCheck = async (scriptTagCheck:SCRIPTTAGCHECK) => {
    const client = createClient({
        url: `https://${scriptTagCheck.shop}/admin/api/2020-07/graphql.json`,
        fetchOptions: {
          headers: {
            "Content-Type": "application/json",
            "X-Shopify-Access-Token": scriptTagCheck.accessToken,
          },
        },
        requestPolicy: "network-only",
        exchanges: [fetchExchange]
    })

    const res = await client.query(getScriptTags).toPromise(); 

    return false;
}
Trending Tags

Trending Tags