Skip to content

Commit

Permalink
docs: update type error on auth hook docs (#4436)
Browse files Browse the repository at this point in the history
  • Loading branch information
salihozdemir authored Jun 1, 2023
1 parent cf07d59 commit be82db0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ type forgotPasswordVariables = {
email: string;
};

export const forgotPasswordPage = () => {
export const ForgotPasswordPage = () => {
const { mutate: forgotPassword } =
useForgotPassword<forgotPasswordVariables>();

const onSubmit = (values: forgotPasswordVariables) => {
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();

const values = {
email: e.currentTarget.email.value,
};

forgotPassword(values);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ type LoginVariables = {
export const LoginPage = () => {
const { mutate: login } = useLogin<LoginVariables>();

const onSubmit = (values: LoginVariables) => {
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();

const values = {
username: e.currentTarget.username.value,
password: e.currentTarget.password.value,
};

login(values);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ type RegisterVariables = {
export const RegisterPage = () => {
const { mutate: register } = useRegister<RegisterVariables>();

const onSubmit = (values: RegisterVariables) => {
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();

const values = {
email: e.currentTarget.email.value,
password: e.currentTarget.password.value,
};

register(values);
};

Expand Down Expand Up @@ -89,7 +96,14 @@ export const RegisterPage = () => {
const { mutate: register } = useRegister<FormVariables>();
const { mutate: login } = useLogin<FormVariables>();

const onSubmit = (values: FormVariables) => {
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();

const values = {
email: e.currentTarget.email.value,
password: e.currentTarget.password.value,
};

register(values, {
//highlight-start
onSuccess: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ type updatePasswordVariables = {
password: string;
};

export const updatePasswordPage = () => {
export const UpdatePasswordPage = () => {
const { mutate: updatePassword } =
useUpdatePassword<updatePasswordVariables>();

const onSubmit = (values: updatePasswordVariables) => {
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();

const values = {
password: e.currentTarget.password.value,
};

updatePassword(values);
};

Expand Down

0 comments on commit be82db0

Please sign in to comment.