mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 03:40:10 +00:00
Fix new recipe creation when reloading the /recipes/new page (fixes #536)
This commit is contained in:
@@ -381,3 +381,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
// Just save the current recipe on every change of the product picker as a workflow could be started which leaves the page...
|
||||
Grocy.Api.Put('objects/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function () { }, function () { });
|
||||
});
|
||||
|
||||
// As the /recipe/new route immediately creates a new recipe on load,
|
||||
// always replace the current location by the created recipes edit page location
|
||||
if (window.location.pathname.toLowerCase() === "/recipe/new")
|
||||
{
|
||||
window.history.replaceState(null, null, U("/recipe/" + Grocy.EditObjectId));
|
||||
}
|
||||
|
Reference in New Issue
Block a user