confluence_web/frontend/dev/scenario-toolbar.js
Artur Mukhamadiev a9908a533f frontend: web UI track handoff (contract revision 1)
Static frontend with vendored marked/DOMPurify, bounded Markdown
pipeline, same-origin mock server with scenario selection, unit,
contract and CDP end-to-end tests under frontend/**.
2026-09-14 21:57:54 +03:00

22 lines
600 B
JavaScript

/**
* Mock Server Dev Toolbar client logic.
* External module to comply with strict CSP (script-src 'self').
*/
(function() {
const sel = document.getElementById('dev-scenario-select');
if (sel) {
sel.addEventListener('change', async function() {
try {
await fetch('/dev/scenario', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ scenario: sel.value })
});
} catch (err) {
console.error('Failed to change scenario:', err);
}
window.location.reload();
});
}
})();