UNPKG

@adonis-agora/authkit-react

Version:

Frontend ergonomics over AuthKit for AdonisJS + Inertia + React apps: a typed useAuth() hook, role-gating hooks and gating components.

19 lines (18 loc) 618 B
export function submitClassicForm(options, deps = {}) { const doc = deps.document ?? (typeof document !== 'undefined' ? document : undefined); if (!doc) return; const form = doc.createElement('form'); form.method = options.method ?? 'POST'; form.action = options.action; form.hidden = true; for (const [name, value] of Object.entries(options.fields)) { const input = doc.createElement('input'); input.type = 'hidden'; input.name = name; input.value = value; form.appendChild(input); } doc.body.appendChild(form); form.submit(); }