mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 03:25:50 +00:00
Fixed LABEL_PRINTER_HOOK_JSON check was missing when running label printer WebHooks client side (fixes #1978)
This commit is contained in:
@@ -505,14 +505,28 @@ Grocy.FrontendHelpers.RunWebhook = function(webhook, data, repetitions = 1)
|
||||
|
||||
for (i = 0; i < repetitions; i++)
|
||||
{
|
||||
$.post(webhook.hook, data).fail(function(req, status, errorThrown)
|
||||
if (webhook.json)
|
||||
{
|
||||
if (!hasAlreadyFailed)
|
||||
$.ajax(webhook.hook, { "data": JSON.stringify(data), "contentType": "application/json", "type": "POST" }).fail(function(req, status, errorThrown)
|
||||
{
|
||||
hasAlreadyFailed = true;
|
||||
Grocy.FrontendHelpers.ShowGenericError(__t("Error while executing WebHook", { "status": status, "errorThrown": errorThrown }));
|
||||
}
|
||||
});
|
||||
if (!hasAlreadyFailed)
|
||||
{
|
||||
hasAlreadyFailed = true;
|
||||
Grocy.FrontendHelpers.ShowGenericError(__t("Error while executing WebHook", { "status": status, "errorThrown": errorThrown }));
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$.post(webhook.hook, data).fail(function(req, status, errorThrown)
|
||||
{
|
||||
if (!hasAlreadyFailed)
|
||||
{
|
||||
hasAlreadyFailed = true;
|
||||
Grocy.FrontendHelpers.ShowGenericError(__t("Error while executing WebHook", { "status": status, "errorThrown": errorThrown }));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user