Initial commit

This commit is contained in:
2025-10-02 08:54:03 +02:00
commit ea54638227
1642 changed files with 53677 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
const { bigcommerceApiOAuth, serverBaseURL, bigcommerceStoreHash } = require("../config.js")
const { deletePrintfulWebhook } = require("../lib/printfulRestAPI.js")
;(function () {
const data = context.data
if (context?.user?.auth()?.id) {
const webhook = context.db.find("webhook", {
filter: {
_id: context.request().param("id"),
},
})[0]
if (webhook.type === "printful") {
deletePrintfulWebhook(webhook.scope)
} else {
let url = `https://api.bigcommerce.com/stores/${bigcommerceStoreHash}/v3/hooks/${webhook.webhookId}`
let options = {
method: "DELETE",
headers: { "Content-Type": "application/json", "X-Auth-Token": bigcommerceApiOAuth },
}
const response = context.http.fetch(url, options).body.json()
}
}
})()