Skip to content

Commit

Permalink
fix: reset form after password changed
Browse files Browse the repository at this point in the history
  • Loading branch information
ledouxm committed Jan 20, 2025
1 parent 5827c60 commit 6b62965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 1 addition & 5 deletions packages/backend/src/db/db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ENV } from "../envVars";
import { DB } from "../db-types"; // this is the Database interface we defined earlier
import { DB } from "../db-types";
import pg from "pg";
import { Kysely, PostgresDialect } from "kysely";

Expand All @@ -9,10 +9,6 @@ const dialect = new PostgresDialect({
}),
});

// Database interface is passed to Kysely's constructor, and from now on, Kysely
// knows your database structure.
// Dialect is passed to Kysely's constructor, and from now on, Kysely knows how
// to communicate with your database.
export const db = new Kysely<DB>({
dialect,
});
10 changes: 7 additions & 3 deletions packages/frontend/src/routes/reset-password.$link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ const ResetPasswordAction = () => {
const form = useForm<any>();
const { link } = Route.useParams();

const mutation = useMutation((body: ResetPasswordActionForm) =>
api.post("/api/reset-password", { body: { newPassword: body.password, temporaryLink: link } }),
);
const mutation = useMutation(async (body: ResetPasswordActionForm) => {
const result = await api.post("/api/reset-password", { body: { newPassword: body.password, temporaryLink: link } });

form.reset();

return result;
});

return (
<Center mt="20px" mb="80px">
Expand Down

0 comments on commit 6b62965

Please sign in to comment.