Skip to content
Discussion options

You must be logged in to vote

Does this work?

  <form
    class="space-y-6"
    action="?/login"
    method="POST"
-    use:enhance={({ data }) => {
+   use:enhance={ async ({data}) => {
      console.log('1');

+  const captcha = new Promise((resolve) => {
      grecaptcha.ready(function () {
        grecaptcha.execute(PUBLIC_RECAPTCHA_SITE_KEY, { action: 'submit' }).then(function (t) {
          console.log('2');
          data.append('token', t);
+        resolve();
        });
      });
+   });
+   await captcha;
      console.log('3');

      return async ({ result }) => {
        await invalidateAll();
        await applyAction(result);
      };
    }}
  >

    <input..../>
    <input.../>

    <button type="sub…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@NormandoHall
Comment options

@NormandoHall
Comment options

@teemingc
Comment options

@NormandoHall
Comment options

@teemingc
Comment options

Answer selected by NormandoHall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants