import { api } from '../api.js'; import { showToast } from '../components/toast.js'; const API = (url, opts = {}) => fetch('/api' + url, { headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${localStorage.getItem('token')}`, ...opts.headers }, ...opts }).then(r => r.json()); export async function render(container) { const hash = window.location.hash; if (hash.startsWith('#/layout/')) { const id = hash.split('#/layout/')[1]; return renderEditor(container, id); } return renderList(container); } async function renderList(container) { container.innerHTML = `
No custom layouts yet