mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 18:33:01 +00:00
verification emails and full email setup
This commit is contained in:
@@ -7,3 +7,4 @@ export * from "@/lib/query/hooks/sprints";
|
||||
export * from "@/lib/query/hooks/subscriptions";
|
||||
export * from "@/lib/query/hooks/timers";
|
||||
export * from "@/lib/query/hooks/users";
|
||||
export * from "@/lib/query/hooks/verification";
|
||||
|
||||
22
packages/frontend/src/lib/query/hooks/verification.ts
Normal file
22
packages/frontend/src/lib/query/hooks/verification.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { apiClient } from "@/lib/server";
|
||||
|
||||
export function useVerifyEmail() {
|
||||
return useMutation<void, Error, { code: string }>({
|
||||
mutationKey: ["verification", "verify"],
|
||||
mutationFn: async ({ code }) => {
|
||||
const { error } = await apiClient.authVerifyEmail({ body: { code } });
|
||||
if (error) throw new Error(error);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useResendVerification() {
|
||||
return useMutation<void, Error>({
|
||||
mutationKey: ["verification", "resend"],
|
||||
mutationFn: async () => {
|
||||
const { error } = await apiClient.authResendVerification({ body: {} });
|
||||
if (error) throw new Error(error);
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user