This commit is contained in:
@@ -336,7 +336,9 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
const actions = document.createElement('div');
|
||||
actions.className = classes.iconRow;
|
||||
actions.appendChild(iconButton('Strecke bearbeiten', '✎', 'edit-route'));
|
||||
actions.appendChild(iconButton('Strecke löschen', '×', 'delete-route', false, true));
|
||||
if (routeSource(route) === 'local') {
|
||||
actions.appendChild(iconButton('Strecke löschen', '×', 'delete-route', false, true));
|
||||
}
|
||||
item.append(label, actions);
|
||||
return item;
|
||||
}
|
||||
@@ -1184,13 +1186,9 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
|
||||
async function deleteRouteFromList(route) {
|
||||
const id = routeId(route);
|
||||
if (!id) return;
|
||||
if (!id || routeSource(route) !== 'local') return;
|
||||
|
||||
if (routeSource(route) === 'local') {
|
||||
ns.LocalRoutes.remove(id);
|
||||
} else {
|
||||
await sendDelete(`/routes/${encodeURIComponent(id)}`);
|
||||
}
|
||||
ns.LocalRoutes.remove(id);
|
||||
|
||||
if (routeId(state.currentRoute) === id && state.currentSource === routeSource(route)) {
|
||||
state.currentRoute = null;
|
||||
@@ -1214,7 +1212,9 @@ globalThis.Wegwichtel = globalThis.Wegwichtel || {};
|
||||
await loadRoute(route);
|
||||
return;
|
||||
}
|
||||
if (action === 'delete-route') await deleteRouteFromList(route);
|
||||
if (action === 'delete-route' && routeSource(route) === 'local') {
|
||||
await deleteRouteFromList(route);
|
||||
}
|
||||
}
|
||||
|
||||
async function deletePoiFromList(poi) {
|
||||
|
||||
Reference in New Issue
Block a user