fix: deleteNavItem uses DELETE method instead of broken POST
This commit is contained in:
parent
ac9f18e4b9
commit
c3455b34cd
1 changed files with 3 additions and 5 deletions
|
|
@ -1154,13 +1154,11 @@ const AdminApp = {
|
||||||
|
|
||||||
async deleteNavItem(index) {
|
async deleteNavItem(index) {
|
||||||
if (!confirm('Delete this navigation item?')) return;
|
if (!confirm('Delete this navigation item?')) return;
|
||||||
this.navData.splice(index, 1);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(this.API + '/navigation', {
|
const res = await fetch(this.API + '/navigation/' + index, {
|
||||||
method: 'POST',
|
method: 'DELETE',
|
||||||
headers: this.authHeaders(),
|
headers: this.authHeaders()
|
||||||
body: JSON.stringify({ label, url, order })
|
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error('Delete failed');
|
if (!res.ok) throw new Error('Delete failed');
|
||||||
this.notify('Nav item deleted');
|
this.notify('Nav item deleted');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue