You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/public/cloud/deploy.js

18 lines
689 B
JavaScript

const runtimeUrl = new URL('/cloud/runtime.js', location.origin);
const assetVersion = new URL(import.meta.url).searchParams.get('v');
if (assetVersion) runtimeUrl.searchParams.set('v', assetVersion);
const {
bindPageCleanup, buy, byId, initializeSession, openCreate,
readBootstrap, showError,
} = await import(runtimeUrl.href);
export async function initialize() {
try {
const bootstrap = readBootstrap('deploy-bootstrap');
if (!await initializeSession('create', bootstrap?.user)) return;
bindPageCleanup();
byId('create-form')?.addEventListener('submit', buy);
await openCreate(bootstrap);
} catch (error) { showError('cloud-page-error', error.message); }
}