Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
import { useMutation } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import {
TSendAccountRecoveryEmailDTO,
TVerifyAccountRecoveryEmailDTO,
TVerifyAccountRecoveryEmailResponse
} from "./types";
export const useSendAccountRecoveryEmail = () => {
return useMutation({
mutationFn: async ({ email, captchaToken }: TSendAccountRecoveryEmailDTO) => {
const { data } = await apiRequest.post("/api/v1/account-recovery/send-email", {
email,
captchaToken
});
return data;
}
});
};
export const useVerifyAccountRecoveryEmail = () => {
return useMutation({
mutationFn: async ({ email, code }: TVerifyAccountRecoveryEmailDTO) => {
const { data } = await apiRequest.post<TVerifyAccountRecoveryEmailResponse>(
"/api/v1/account-recovery/verify-email",
{
email,
code
}
);
return data;
}
});
};
export const useEnableEmailAuthAccountRecovery = () => {
return useMutation({
mutationFn: async (token: string) => {
const { data } = await apiRequest.post<TVerifyAccountRecoveryEmailResponse>(
"/api/v1/account-recovery/enable-email-auth",
undefined,
{
headers: {
authorization: `Bearer ${token}`
}
}
);
return data;
}
});
};