#Warning not using POST method when using qwik/auth + <Form action={authAction}>

7 messages · Page 1 of 1 (latest)

lapis bay
#

I get a warning in my terminal telling me to add a method="post" field to my <form> component when I use the code from the qwik/auth documentation. When I add method="POST" to the <Form> I get a type error... ):

Does anyone know how I can fix this?

The warning:

Seems like you are submitting a Qwik Action via GET request. Qwik Actions should be submitted via POST request.
Make sure your <form> has method="POST" attribute, like this: <form method="POST">

With this code

// page
const SomePage = component$(() => {
  return (
    <>
      <SignInButton />
    </>
  );
});

// component
const SignInButton = component$(() => {
  const signIn = useAuthSignin();
  return (
    <>
      <Form action={signIn}>
        <button>
          Sign in
        </button>
      </Form>
    </>
  );
});

The typeError code: notice the method='post' in the <Form>

// page
const SomePage = component$(() => {
  return (
    <>
      <SignInButton />
    </>
  );
});

// component
const SignInButton = component$(() => {
  const signIn = useAuthSignin();
  return (
    <>
      <Form action={signIn} method="POST">
        <button>
          Sign in
        </button>
      </Form>
    </>
  );
});

#

You're trying to access method on an object that doesn't contain it.

lapis bay
#

Extra: rendered html on the client

lapis bay
#

Instead of using the Form component I opted for using a onClick$ on a <button> instead

#

so now I have no warnings anymore

modern umbra
#

same problem here and i'd rather use the Form component but i'm enable to get rid of this warning !

fallen island
#

I recommend creating an issue on GitHub if the problem persists. Until then, you can test if the problem does not occur with an older version. With Modular Forms everything works with Qwik v1.1.5.