fix: ensure recipe deletion removes database entries, images, and favorites
All checks were successful
CI / update (push) Successful in 1m12s
All checks were successful
CI / update (push) Successful in 1m12s
Fixes critical bug where recipes could not be deleted properly. The delete function had an early return statement that prevented database deletion from executing, leaving orphaned entries. Additionally, deleted recipes were not removed from users' favorites lists. Changes: - Remove premature return statement blocking database deletion - Fix malformed fetch call structure (headers were inside body JSON) - Add UserFavorites cleanup to remove deleted recipes from all users' favorites - Ensure complete cleanup: database entry, image files (hashed and unhashed), and favorites references
This commit is contained in:
@@ -209,16 +209,15 @@
|
||||
//alert(item.message)
|
||||
return
|
||||
}
|
||||
return
|
||||
const res = await fetch('/api/rezepte/delete', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
old_short_name,
|
||||
}),
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
}
|
||||
})
|
||||
|
||||
credentials: 'include',
|
||||
}
|
||||
})
|
||||
if(res.ok){
|
||||
const url = location.href.split('/')
|
||||
|
||||
Reference in New Issue
Block a user