{ // Interceptar solo en el paso 1 antes de hacer el submit real if (!readyToSubmit) { cancel(); loading = true; tenants = await fetchTenants(); loading = false; if (tenants.length === 1) { // 1 sola org: login directo tenantSlug = tenants[0].slug; readyToSubmit = true; await tick(); // esperar a que el DOM refleje tenantSlug antes de enviar formEl?.requestSubmit(); } else if (tenants.length > 1) { // Varias orgs: mostrar selector step = 2; } else { // 0 orgs: enviar igual, el backend rechazará readyToSubmit = true; await tick(); formEl?.requestSubmit(); } return; } loading = true; return async ({ update, result }) => { await update(); loading = false; readyToSubmit = false; if (result.type === 'failure') { clearClientCookies(); } }; }} >
Anexo 76

Anexo 76

Sistema de Cumplimiento Fiscal y Aduanal

{#if error}
{error}
{/if} {#if step === 2} {/if} {#if step === 1} Usuario
o continúa con

¿No tienes cuenta?{' '} Regístrate

{:else}

Selecciona tu organización

Tu cuenta tiene acceso a varias organizaciones

{#each tenants as t} {/each}
{/if}

Al continuar, aceptas nuestros Términos de Servicio y Política de Privacidad.