From 6b41e5212c27c881b96379fb993a7bbfd6636ca0 Mon Sep 17 00:00:00 2001 From: Christopher Forkner Date: Tue, 8 Jan 2019 13:14:15 -0700 Subject: [PATCH] Verb-less Generic Entity Interactions --- public/viewjs/batteries.js | 2 +- public/viewjs/batteryform.js | 6 +++--- public/viewjs/choreform.js | 4 ++-- public/viewjs/chores.js | 2 +- public/viewjs/equipment.js | 4 ++-- public/viewjs/equipmentform.js | 8 ++++---- public/viewjs/inventory.js | 2 +- public/viewjs/locationform.js | 6 +++--- public/viewjs/locations.js | 2 +- public/viewjs/manageapikeys.js | 2 +- public/viewjs/productform.js | 8 ++++---- public/viewjs/productgroupform.js | 6 +++--- public/viewjs/productgroups.js | 2 +- public/viewjs/products.js | 2 +- public/viewjs/purchase.js | 2 +- public/viewjs/quantityunitform.js | 6 +++--- public/viewjs/quantityunits.js | 2 +- public/viewjs/recipeform.js | 26 +++++++++++++------------- public/viewjs/recipeposform.js | 4 ++-- public/viewjs/recipes.js | 2 +- public/viewjs/shoppinglist.js | 2 +- public/viewjs/shoppinglistform.js | 4 ++-- public/viewjs/taskcategories.js | 2 +- public/viewjs/taskcategoryform.js | 6 +++--- public/viewjs/taskform.js | 6 +++--- public/viewjs/tasks.js | 2 +- routes.php | 18 +++++++++--------- 27 files changed, 69 insertions(+), 69 deletions(-) diff --git a/public/viewjs/batteries.js b/public/viewjs/batteries.js index 3097c391..68bcf349 100644 --- a/public/viewjs/batteries.js +++ b/public/viewjs/batteries.js @@ -52,7 +52,7 @@ $(document).on('click', '.battery-delete-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/batteries/' + objectId, + Grocy.Api.Delete('object/batteries/' + objectId, function(result) { window.location.href = U('/batteries'); diff --git a/public/viewjs/batteryform.js b/public/viewjs/batteryform.js index 46970ab8..2b084821 100644 --- a/public/viewjs/batteryform.js +++ b/public/viewjs/batteryform.js @@ -7,7 +7,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/batteries', jsonData, + Grocy.Api.Post('object/batteries', jsonData, function(result) { window.location.href = U('/batteries'); @@ -21,7 +21,7 @@ } else { - Grocy.Api.Post('edit-object/batteries/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/batteries/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/batteries'); @@ -45,7 +45,7 @@ $('#battery-form input').keydown(function(event) if (event.keyCode === 13) //Enter { event.preventDefault(); - + if (document.getElementById('battery-form').checkValidity() === false) //There is at least one validation error { return false; diff --git a/public/viewjs/choreform.js b/public/viewjs/choreform.js index ca8a4543..f564d01d 100644 --- a/public/viewjs/choreform.js +++ b/public/viewjs/choreform.js @@ -7,7 +7,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/chores', jsonData, + Grocy.Api.Post('object/chores', jsonData, function(result) { window.location.href = U('/chores'); @@ -21,7 +21,7 @@ } else { - Grocy.Api.Post('edit-object/chores/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/chores/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/chores'); diff --git a/public/viewjs/chores.js b/public/viewjs/chores.js index e3666826..aacb8b7e 100644 --- a/public/viewjs/chores.js +++ b/public/viewjs/chores.js @@ -52,7 +52,7 @@ $(document).on('click', '.chore-delete-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/chores/' + objectId, + Grocy.Api.Delete('object/chores/' + objectId, function(result) { window.location.href = U('/chores'); diff --git a/public/viewjs/equipment.js b/public/viewjs/equipment.js index 0ac99eca..a524a42a 100644 --- a/public/viewjs/equipment.js +++ b/public/viewjs/equipment.js @@ -34,7 +34,7 @@ equipmentTable.on('select', function(e, dt, type, indexes) function DisplayEquipment(id) { - Grocy.Api.Get('get-object/equipment/' + id, + Grocy.Api.Get('object/equipment/' + id, function(equipmentItem) { $(".selected-equipment-name").text(equipmentItem.name); @@ -98,7 +98,7 @@ $(document).on('click', '.equipment-delete-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/equipment/' + objectId, + Grocy.Api.Delete('object/equipment/' + objectId, function(result) { window.location.href = U('/equipment'); diff --git a/public/viewjs/equipmentform.js b/public/viewjs/equipmentform.js index e0340cbe..d8edc32a 100644 --- a/public/viewjs/equipmentform.js +++ b/public/viewjs/equipmentform.js @@ -15,10 +15,10 @@ { jsonData.instruction_manual_file_name = null; } - + if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/equipment', jsonData, + Grocy.Api.Post('object/equipment', jsonData, function(result) { if (jsonData.hasOwnProperty("instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave) @@ -64,7 +64,7 @@ ); }; - Grocy.Api.Post('edit-object/equipment/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/equipment/' + Grocy.EditObjectId, jsonData, function(result) { if (jsonData.hasOwnProperty("instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave) @@ -105,7 +105,7 @@ $('#equipment-form input').keydown(function(event) if (event.keyCode === 13) //Enter { event.preventDefault(); - + if (document.getElementById('equipment-form').checkValidity() === false) //There is at least one validation error { return false; diff --git a/public/viewjs/inventory.js b/public/viewjs/inventory.js index af647d70..d87447ec 100644 --- a/public/viewjs/inventory.js +++ b/public/viewjs/inventory.js @@ -24,7 +24,7 @@ productDetails.product.barcode += ',' + addBarcode; } - Grocy.Api.Post('edit-object/products/' + productDetails.product.id, productDetails.product, + Grocy.Api.Put('object/products/' + productDetails.product.id, productDetails.product, function (result) { }, function(xhr) { diff --git a/public/viewjs/locationform.js b/public/viewjs/locationform.js index 81878b86..94668031 100644 --- a/public/viewjs/locationform.js +++ b/public/viewjs/locationform.js @@ -7,7 +7,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/locations', jsonData, + Grocy.Api.Post('object/locations', jsonData, function(result) { window.location.href = U('/locations'); @@ -21,7 +21,7 @@ } else { - Grocy.Api.Post('edit-object/locations/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/locations/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/locations'); @@ -45,7 +45,7 @@ $('#location-form input').keydown(function (event) if (event.keyCode === 13) //Enter { event.preventDefault(); - + if (document.getElementById('location-form').checkValidity() === false) //There is at least one validation error { return false; diff --git a/public/viewjs/locations.js b/public/viewjs/locations.js index 9e12f71e..4c85ecd3 100644 --- a/public/viewjs/locations.js +++ b/public/viewjs/locations.js @@ -52,7 +52,7 @@ $(document).on('click', '.location-delete-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/locations/' + objectId, + Grocy.Api.Delete('object/locations/' + objectId, function(result) { window.location.href = U('/locations'); diff --git a/public/viewjs/manageapikeys.js b/public/viewjs/manageapikeys.js index 427b1b08..bfcaf263 100644 --- a/public/viewjs/manageapikeys.js +++ b/public/viewjs/manageapikeys.js @@ -58,7 +58,7 @@ $(document).on('click', '.apikey-delete-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/api_keys/' + objectId, + Grocy.Api.Delete('object/api_keys/' + objectId, function(result) { window.location.href = U('/manageapikeys'); diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js index 3bc540ec..d792d8ca 100644 --- a/public/viewjs/productform.js +++ b/public/viewjs/productform.js @@ -25,7 +25,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/products', jsonData, + Grocy.Api.Post('object/products', jsonData, function (result) { if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave) @@ -71,7 +71,7 @@ ); }; - Grocy.Api.Post('edit-object/products/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/products/' + Grocy.EditObjectId, jsonData, function(result) { if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave) @@ -110,7 +110,7 @@ $('#barcode-taginput').tagsManager({ if (Grocy.EditMode === 'edit') { - Grocy.Api.Get('get-object/products/' + Grocy.EditObjectId, + Grocy.Api.Get('object/products/' + Grocy.EditObjectId, function (product) { if (product.barcode !== null && product.barcode.length > 0) @@ -182,7 +182,7 @@ $('#product-form input').keydown(function(event) if (event.keyCode === 13) //Enter { event.preventDefault(); - + if (document.getElementById('product-form').checkValidity() === false) //There is at least one validation error { return false; diff --git a/public/viewjs/productgroupform.js b/public/viewjs/productgroupform.js index 48140375..b553d039 100644 --- a/public/viewjs/productgroupform.js +++ b/public/viewjs/productgroupform.js @@ -7,7 +7,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/product_groups', jsonData, + Grocy.Api.Post('object/product_groups', jsonData, function(result) { window.location.href = U('/productgroups'); @@ -21,7 +21,7 @@ } else { - Grocy.Api.Post('edit-object/product_groups/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/product_groups/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/productgroups'); @@ -45,7 +45,7 @@ $('#product-group-form input').keydown(function (event) if (event.keyCode === 13) //Enter { event.preventDefault(); - + if (document.getElementById('product-group-form').checkValidity() === false) //There is at least one validation error { return false; diff --git a/public/viewjs/productgroups.js b/public/viewjs/productgroups.js index bea06e55..b03c4b14 100644 --- a/public/viewjs/productgroups.js +++ b/public/viewjs/productgroups.js @@ -52,7 +52,7 @@ $(document).on('click', '.product-group-delete-button', function(e) { if (result === true) { - Grocy.Api.Delete('delete-object/product_groups/' + objectId, + Grocy.Api.Delete('object/product_groups/' + objectId, function(result) { window.location.href = U('/productgroups'); diff --git a/public/viewjs/products.js b/public/viewjs/products.js index 1b35f08b..8ee0d7a4 100644 --- a/public/viewjs/products.js +++ b/public/viewjs/products.js @@ -59,7 +59,7 @@ $(document).on('click', '.product-delete-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/products/' + objectId, + Grocy.Api.Delete('object/products/' + objectId, function (result) { window.location.href = U('/products'); diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index bc5048f4..e82433a6 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -32,7 +32,7 @@ productDetails.product.barcode += ',' + addBarcode; } - Grocy.Api.Post('edit-object/products/' + productDetails.product.id, productDetails.product, + Grocy.Api.Put('object/products/' + productDetails.product.id, productDetails.product, function (result) { }, function(xhr) { diff --git a/public/viewjs/quantityunitform.js b/public/viewjs/quantityunitform.js index 83238b7b..2855e93a 100644 --- a/public/viewjs/quantityunitform.js +++ b/public/viewjs/quantityunitform.js @@ -7,7 +7,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/quantity_units', jsonData, + Grocy.Api.Post('object/quantity_units', jsonData, function(result) { window.location.href = U('/quantityunits'); @@ -21,7 +21,7 @@ } else { - Grocy.Api.Post('edit-object/quantity_units/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/quantity_units/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/quantityunits'); @@ -45,7 +45,7 @@ $('#quantityunit-form input').keydown(function(event) if (event.keyCode === 13) //Enter { event.preventDefault(); - + if (document.getElementById('quantityunit-form').checkValidity() === false) //There is at least one validation error { return false; diff --git a/public/viewjs/quantityunits.js b/public/viewjs/quantityunits.js index 21d01064..15a0d6d6 100644 --- a/public/viewjs/quantityunits.js +++ b/public/viewjs/quantityunits.js @@ -52,7 +52,7 @@ $(document).on('click', '.quantityunit-delete-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/quantity_units/' + objectId, + Grocy.Api.Delete('object/quantity_units/' + objectId, function(result) { window.location.href = U('/quantityunits'); diff --git a/public/viewjs/recipeform.js b/public/viewjs/recipeform.js index 6248284f..e4a0ee56 100644 --- a/public/viewjs/recipeform.js +++ b/public/viewjs/recipeform.js @@ -5,7 +5,7 @@ var jsonData = $('#recipe-form').serializeJSON(); Grocy.FrontendHelpers.BeginUiBusy("recipe-form"); - Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/recipes'); @@ -113,8 +113,8 @@ $(document).on('click', '.recipe-pos-delete-button', function(e) { if (result === true) { - Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { }); - Grocy.Api.Delete('delete-object/recipes_pos/' + objectId, + Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { }); + Grocy.Api.Delete('object/recipes_pos/' + objectId, function(result) { window.location.href = U('/recipe/' + Grocy.EditObjectId); @@ -150,8 +150,8 @@ $(document).on('click', '.recipe-include-delete-button', function(e) { if (result === true) { - Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { }); - Grocy.Api.Delete('delete-object/recipes_nestings/' + objectId, + Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { }); + Grocy.Api.Delete('object/recipes_nestings/' + objectId, function(result) { window.location.href = U('/recipe/' + Grocy.EditObjectId); @@ -178,10 +178,10 @@ $(document).on('click', '.recipe-pos-order-missing-button', function(e) jsonData.amount = productAmount; jsonData.note = L('Added for recipe #1', recipeName); - Grocy.Api.Post('add-object/shopping_list', jsonData, + Grocy.Api.Post('object/shopping_list', jsonData, function(result) { - Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function () { }, function () { }); + Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function () { }, function () { }); window.location.href = U('/recipe/' + Grocy.EditObjectId); }, function(xhr) @@ -202,7 +202,7 @@ $(document).on('click', '.recipe-pos-edit-button', function (e) { var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id'); - Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), + Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function(result) { window.location.href = U('/recipe/' + Grocy.EditObjectId + '/pos/' + recipePosId); @@ -219,7 +219,7 @@ $(document).on('click', '.recipe-include-edit-button', function (e) var id = $(e.currentTarget).attr('data-recipe-include-id'); var recipeId = $(e.currentTarget).attr('data-recipe-included-recipe-id'); console.log(recipeId); - Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), + Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function(result) { $("#recipe-include-editform-title").text(L("Edit included recipe")); @@ -238,7 +238,7 @@ $(document).on('click', '.recipe-include-edit-button', function (e) $("#recipe-pos-add-button").on("click", function(e) { - Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), + Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function(result) { window.location.href = U('/recipe/' + Grocy.EditObjectId + '/pos/new'); @@ -252,7 +252,7 @@ $("#recipe-pos-add-button").on("click", function(e) $("#recipe-include-add-button").on("click", function(e) { - Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), + Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function(result) { $("#recipe-include-editform-title").text(L("Add included recipe")); @@ -280,7 +280,7 @@ $('#save-recipe-include-button').on('click', function(e) if (editMode === 'create') { - Grocy.Api.Post('add-object/recipes_nestings', jsonData, + Grocy.Api.Post('object/recipes_nestings', jsonData, function(result) { window.location.href = U('/recipe/' + Grocy.EditObjectId); @@ -293,7 +293,7 @@ $('#save-recipe-include-button').on('click', function(e) } else { - Grocy.Api.Post('edit-object/recipes_nestings/' + nestingId, jsonData, + Grocy.Api.Put('object/recipes_nestings/' + nestingId, jsonData, function(result) { window.location.href = U('/recipe/' + Grocy.EditObjectId); diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js index dd125a27..79221c73 100644 --- a/public/viewjs/recipeposform.js +++ b/public/viewjs/recipeposform.js @@ -9,7 +9,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/recipes_pos', jsonData, + Grocy.Api.Post('object/recipes_pos', jsonData, function(result) { window.location.href = U('/recipe/' + Grocy.EditObjectParentId); @@ -23,7 +23,7 @@ } else { - Grocy.Api.Post('edit-object/recipes_pos/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/recipes_pos/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/recipe/' + Grocy.EditObjectParentId); diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js index 24446afe..ed6595f6 100644 --- a/public/viewjs/recipes.js +++ b/public/viewjs/recipes.js @@ -63,7 +63,7 @@ $("#selectedRecipeDeleteButton").on('click', function(e) { if (result === true) { - Grocy.Api.Delete('delete-object/recipes/' + objectId, + Grocy.Api.Delete('object/recipes/' + objectId, function(result) { window.location.href = U('/recipes'); diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index 9e29ec4b..557d5451 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -64,7 +64,7 @@ $(document).on('click', '.shoppinglist-delete-button', function (e) var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id'); Grocy.FrontendHelpers.BeginUiBusy(); - Grocy.Api.Delete('delete-object/shopping_list/' + shoppingListItemId, + Grocy.Api.Delete('object/shopping_list/' + shoppingListItemId, function(result) { $('#shoppinglistitem-' + shoppingListItemId + '-row').fadeOut(500, function() diff --git a/public/viewjs/shoppinglistform.js b/public/viewjs/shoppinglistform.js index 361875dc..615a7462 100644 --- a/public/viewjs/shoppinglistform.js +++ b/public/viewjs/shoppinglistform.js @@ -7,7 +7,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/shopping_list', jsonData, + Grocy.Api.Post('object/shopping_list', jsonData, function(result) { window.location.href = U('/shoppinglist'); @@ -21,7 +21,7 @@ } else { - Grocy.Api.Post('edit-object/shopping_list/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/shopping_list/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/shoppinglist'); diff --git a/public/viewjs/taskcategories.js b/public/viewjs/taskcategories.js index caec76b7..99a49ebb 100644 --- a/public/viewjs/taskcategories.js +++ b/public/viewjs/taskcategories.js @@ -52,7 +52,7 @@ $(document).on('click', '.task-category-delete-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/task_categories/' + objectId, + Grocy.Api.Delete('object/task_categories/' + objectId, function(result) { window.location.href = U('/taskcategories'); diff --git a/public/viewjs/taskcategoryform.js b/public/viewjs/taskcategoryform.js index adca8e66..baba4f01 100644 --- a/public/viewjs/taskcategoryform.js +++ b/public/viewjs/taskcategoryform.js @@ -7,7 +7,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/task_categories', jsonData, + Grocy.Api.Post('object/task_categories', jsonData, function(result) { window.location.href = U('/taskcategories'); @@ -21,7 +21,7 @@ } else { - Grocy.Api.Post('edit-object/task_categories/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/task_categories/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/taskcategories'); @@ -45,7 +45,7 @@ $('#task-category-form input').keydown(function (event) if (event.keyCode === 13) //Enter { event.preventDefault(); - + if (document.getElementById('task-category-form').checkValidity() === false) //There is at least one validation error { return false; diff --git a/public/viewjs/taskform.js b/public/viewjs/taskform.js index 00d5a1c2..7cb93896 100644 --- a/public/viewjs/taskform.js +++ b/public/viewjs/taskform.js @@ -11,7 +11,7 @@ if (Grocy.EditMode === 'create') { - Grocy.Api.Post('add-object/tasks', jsonData, + Grocy.Api.Post('object/tasks', jsonData, function(result) { window.location.href = U('/tasks'); @@ -25,7 +25,7 @@ } else { - Grocy.Api.Post('edit-object/tasks/' + Grocy.EditObjectId, jsonData, + Grocy.Api.Put('object/tasks/' + Grocy.EditObjectId, jsonData, function(result) { window.location.href = U('/tasks'); @@ -49,7 +49,7 @@ $('#task-form input').keydown(function(event) if (event.keyCode === 13) //Enter { event.preventDefault(); - + if (document.getElementById('task-form').checkValidity() === false) //There is at least one validation error { return false; diff --git a/public/viewjs/tasks.js b/public/viewjs/tasks.js index 2f14b50d..783932b0 100644 --- a/public/viewjs/tasks.js +++ b/public/viewjs/tasks.js @@ -123,7 +123,7 @@ $(document).on('click', '.delete-task-button', function (e) { if (result === true) { - Grocy.Api.Delete('delete-object/tasks/' + objectId, + Grocy.Api.Delete('object/tasks/' + objectId, function(result) { $('#task-' + objectId + '-row').fadeOut(500, function () diff --git a/routes.php b/routes.php index 854d19c2..71130f8a 100644 --- a/routes.php +++ b/routes.php @@ -83,11 +83,11 @@ $app->group('/api', function() $this->get('/get-openapi-specification', '\Grocy\Controllers\OpenApiController:DocumentationSpec'); // Generic entity interaction - $this->get('/get-objects/{entity}', '\Grocy\Controllers\GenericEntityApiController:GetObjects'); - $this->get('/get-object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:GetObject'); - $this->post('/add-object/{entity}', '\Grocy\Controllers\GenericEntityApiController:AddObject'); - $this->put('/edit-object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:EditObject'); - $this->delete('/delete-object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:DeleteObject'); + $this->get('/object/{entity}', '\Grocy\Controllers\GenericEntityApiController:GetObjects'); + $this->get('/object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:GetObject'); + $this->post('/object/{entity}', '\Grocy\Controllers\GenericEntityApiController:AddObject'); + $this->put('/object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:EditObject'); + $this->delete('/object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:DeleteObject'); // System $this->get('/system/get-db-changed-time', '\Grocy\Controllers\SystemApiController:GetDbChangedTime'); @@ -99,10 +99,10 @@ $app->group('/api', function() $this->delete('/file/{group}', '\Grocy\Controllers\FilesApiController:DeleteFile'); // Users - $this->get('/users/get', '\Grocy\Controllers\UsersApiController:GetUsers'); - $this->post('/users/create', '\Grocy\Controllers\UsersApiController:CreateUser'); - $this->put('/users/edit/{userId}', '\Grocy\Controllers\UsersApiController:EditUser'); - $this->delete('/users/delete/{userId}', '\Grocy\Controllers\UsersApiController:DeleteUser'); + $this->get('/users', '\Grocy\Controllers\UsersApiController:GetUsers'); + $this->post('/users', '\Grocy\Controllers\UsersApiController:CreateUser'); + $this->put('/users/{userId}', '\Grocy\Controllers\UsersApiController:EditUser'); + $this->delete('/users/{userId}', '\Grocy\Controllers\UsersApiController:DeleteUser'); // User $this->get('/user/settings/{settingKey}', '\Grocy\Controllers\UsersApiController:GetUserSetting');