react-code-dataset / Reactive-Resume /apps /client /src /services /auth /two-factor-authentication /enable.ts
Download Reactive-Resume/apps/client/src/services/auth/two-factor-authentication/enable.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 662 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Reactive-Resume/apps/client/src/services/auth/two-factor-authentication/enable.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Reactive-Resume/apps/client/src/services/auth/two-factor-authentication/enable.ts
-
curl -L -o enable.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Reactive-Resume/apps/client/src/services/auth/two-factor-authentication/enable.ts
662 Bytes
| import type { BackupCodesDto, TwoFactorDto } from "@reactive-resume/dto"; | |
| import { useMutation } from "@tanstack/react-query"; | |
| import type { AxiosResponse } from "axios"; | |
| import { axios } from "@/client/libs/axios"; | |
| export const enable2FA = async (data: TwoFactorDto) => { | |
| const response = await axios.post<BackupCodesDto, AxiosResponse<BackupCodesDto>, TwoFactorDto>( | |
| "/auth/2fa/enable", | |
| data, | |
| ); | |
| return response.data; | |
| }; | |
| export const useEnable2FA = () => { | |
| const { | |
| error, | |
| isPending: loading, | |
| mutateAsync: enable2FAFn, | |
| } = useMutation({ | |
| mutationFn: enable2FA, | |
| }); | |
| return { enable2FA: enable2FAFn, loading, error }; | |
| }; | |