More improvements on the REST API (references #139)

This commit is contained in:
Bernd Bestel
2019-01-21 22:13:42 +01:00
parent bfa59dd29c
commit 276bc94cc6
15 changed files with 102 additions and 85 deletions

View File

@@ -56,7 +56,7 @@ $(document).on('click', '.undo-battery-execution-button', function(e)
var element = $(e.currentTarget);
var chargeCycleId = $(e.currentTarget).attr('data-charge-cycle-id');
Grocy.Api.Post('batteries/' + chargeCycleId.toString() + '/undo', { },
Grocy.Api.Post('batteries/charge-cycles/' + chargeCycleId.toString() + '/undo', { },
function(result)
{
element.closest("tr").addClass("text-muted");

View File

@@ -92,7 +92,7 @@ $('#tracked_time').find('input').on('keypress', function (e)
function UndoChargeCycle(chargeCycleId)
{
Grocy.Api.Post('batteries/' + chargeCycleId.toString() + '/undo', { },
Grocy.Api.Post('batteries/charge-cycles/' + chargeCycleId.toString() + '/undo', { },
function(result)
{
toastr.success(L("Charge cycle successfully undone"));

View File

@@ -56,7 +56,7 @@ $(document).on('click', '.undo-chore-execution-button', function(e)
var element = $(e.currentTarget);
var executionId = $(e.currentTarget).attr('data-execution-id');
Grocy.Api.Post('chores/' + executionId.toString() + '/undo', { },
Grocy.Api.Post('chores/executions/' + executionId.toString() + '/undo', { },
function(result)
{
element.closest("tr").addClass("text-muted");

View File

@@ -89,7 +89,7 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
function UndoChoreExecution(executionId)
{
Grocy.Api.Post('chores/' + executionId.toString() + '/undo', { },
Grocy.Api.Post('chores/executions/' + executionId.toString() + '/undo', { },
function(result)
{
toastr.success(L("Chore execution successfully undone"));

View File

@@ -41,7 +41,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
{
$("#productcard-no-product-picture").addClass("d-none");
$("#productcard-product-picture").removeClass("d-none");
$("#productcard-product-picture").attr("src", U('/api/file/productpictures?file_name=' + productDetails.product.picture_file_name));
$("#productcard-product-picture").attr("src", U('/api/files/productpictures/' + btoa(productDetails.product.picture_file_name)));
}
else
{

View File

@@ -43,7 +43,7 @@ function DisplayEquipment(id)
if (equipmentItem.instruction_manual_file_name !== null && !equipmentItem.instruction_manual_file_name.isEmpty())
{
var pdfUrl = U('/api/file/equipmentmanuals?file_name=' + equipmentItem.instruction_manual_file_name);
var pdfUrl = U('/api/files/equipmentmanuals/' + btoa(equipmentItem.instruction_manual_file_name));
$("#selected-equipment-instruction-manual").attr("src", pdfUrl);
$("#selected-equipment-instruction-manual").removeClass("d-none");
$("#selected-equipment-has-no-instruction-manual-hint").addClass("d-none");

View File

@@ -197,7 +197,7 @@ $('#new_amount').on('keyup', function(e)
function UndoStockBooking(bookingId)
{
Grocy.Api.Get('booking/' + bookingId.toString() + '/undo',
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
function(result)
{
toastr.success(L("Booking successfully undone"));

View File

@@ -202,7 +202,7 @@ if (GetUriParam("flow") === "shoppinglistitemtostock")
function UndoStockBooking(bookingId)
{
Grocy.Api.Get('sbooking/' + bookingId.toString() + '/undo',
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
function(result)
{
toastr.success(L("Booking successfully undone"));

View File

@@ -7,7 +7,7 @@
if (Grocy.EditMode === 'create')
{
Grocy.Api.Post('users/create', jsonData,
Grocy.Api.Post('users', jsonData,
function(result)
{
window.location.href = U('/users');
@@ -21,7 +21,7 @@
}
else
{
Grocy.Api.Post('users/edit/' + Grocy.EditObjectId, jsonData,
Grocy.Api.Put('users/' + Grocy.EditObjectId, jsonData,
function(result)
{
window.location.href = U('/users');