function initDashboard() {
const url = new URL(location.href);
const token = url.searchParams.get("token") || "";
const dashboardId = url.searchParams.get("dashboardId") || "";
// Create the dashboard element
const dashboardElement = document.createElement('dbn-dashboard');
// Set attributes
if (token) {
dashboardElement.setAttribute('token', token);
}
if (dashboardId) {
dashboardElement.setAttribute('dashboard-id', dashboardId);
}
// Append the dashboard to the body
document.body.appendChild(dashboardElement);
}
// Initialize the dashboard when the DOM is fully loaded
document.addEventListener('DOMContentLoaded', initDashboard);