Shopify脚本标签创建方法不会在控制台中显示响应

问题描述 投票:0回答:1

我正在尝试使用shopify-node-app创建Shopify应用程序。我已经完成了制作应用程序的所有初始设置。我已经完成了设置App-Proxy。我已经开始使用脚本标记,这是制作应用程序的必要部分。我正在使用shopify-api-node创建ScriptTag create方法,代码如下。

const registerScriptTags = function(shopDomain, accessToken, scriptTag) {
const shopName=shopDomain.replace('.myshopify.com','');
const shopify = new ShopifyAPIClient({ shopName: shopName, accessToken: accessToken });

console.log('scriptTag= ', scriptTag);

shopify.scriptTag.create({
  event: 'onload',
  src: 'http://yourjavascript.com/1448951127/scripttag.js'
})
.then(response => console.log(response))
.catch(err => console.error(err));

console.log('scriptTag= ', scriptTag);
}

我没有在控制台中看到任何qazxsw poi,qazxsw poi,qazxsw poi。

我需要检查我是否通过params调用此函数。我正在添加scriptTag作为第三个参数,但也在功能上对其进行硬编码。

我需要做什么? 1)我是否需要点击任何特定网址才能看到response? 2)任何人都可以使用相同的代码解释上面的最后两个声明吗?

谢谢。

node.js api shopify shopify-app script-tag
1个回答
0
投票

上面的代码是完美的。我必须停止并重新启动服务器应用程序,除非您使用当前不是的nodemon。我也卸载并重新安装在演示商店中的应用程序。由于afterAuth在安装后被调用一次。因此,afterAuth,registerWebhook,registerScriptTag中的任何代码更改都需要卸载和安装。

© www.soinside.com 2019 - 2024. All rights reserved.