25 lines
665 B
JavaScript
25 lines
665 B
JavaScript
// /utils/openInNewTab.js
|
|
import { BASE_URL } from "../config/urls";
|
|
|
|
export function openInNewTab(e, target) {
|
|
let link;
|
|
|
|
if (target instanceof L.Polyline) {
|
|
const idLD = target.options.idLD;
|
|
if (idLD) {
|
|
link = `${BASE_URL}cpl.aspx?id=${idLD}`;
|
|
} else {
|
|
console.error("Keine gültige 'idLD' für die Linie gefunden.");
|
|
return;
|
|
}
|
|
} else if (target instanceof L.Marker && target.options.link) {
|
|
link = BASE_URL + target.options.link;
|
|
} else {
|
|
console.error("Fehler: Ungültiges Ziel oder keine gültige 'link' Eigenschaft.");
|
|
return;
|
|
}
|
|
|
|
// Öffne den Link in einem neuen Tab
|
|
window.open(link, "_blank");
|
|
}
|