Chore: Convert client/views/account/security folder to ts (#26413)
parent
b11bab5e7e
commit
1431f2e1d2
@ -1,14 +1,14 @@ |
||||
import { Box, Button, Margins } from '@rocket.chat/fuselage'; |
||||
import { useUser, useTranslation } from '@rocket.chat/ui-contexts'; |
||||
import React, { useCallback } from 'react'; |
||||
import React, { ComponentProps, ReactElement, useCallback } from 'react'; |
||||
|
||||
import { useEndpointAction } from '../../../hooks/useEndpointAction'; |
||||
|
||||
const TwoFactorEmail = (props) => { |
||||
const TwoFactorEmail = (props: ComponentProps<typeof Box>): ReactElement => { |
||||
const t = useTranslation(); |
||||
const user = useUser(); |
||||
|
||||
const isEnabled = user && user.services && user.services.email2fa && user.services.email2fa.enabled; |
||||
const isEnabled = user?.services?.email2fa?.enabled; |
||||
|
||||
const enable2faAction = useEndpointAction('POST', '/v1/users.2fa.enableEmail', undefined, t('Two-factor_authentication_enabled')); |
||||
const disable2faAction = useEndpointAction('POST', '/v1/users.2fa.disableEmail', undefined, t('Two-factor_authentication_disabled')); |
||||
@ -0,0 +1,48 @@ |
||||
type TypeNumber = |
||||
| 1 |
||||
| 2 |
||||
| 3 |
||||
| 4 |
||||
| 5 |
||||
| 6 |
||||
| 7 |
||||
| 8 |
||||
| 9 |
||||
| 10 |
||||
| 11 |
||||
| 12 |
||||
| 13 |
||||
| 14 |
||||
| 15 |
||||
| 16 |
||||
| 17 |
||||
| 18 |
||||
| 19 |
||||
| 20 |
||||
| 21 |
||||
| 22 |
||||
| 23 |
||||
| 24 |
||||
| 25 |
||||
| 26 |
||||
| 27 |
||||
| 28 |
||||
| 29 |
||||
| 30 |
||||
| 31 |
||||
| 32 |
||||
| 33 |
||||
| 34 |
||||
| 35 |
||||
| 36 |
||||
| 37 |
||||
| 38 |
||||
| 39; |
||||
interface Params { |
||||
size?: number; |
||||
errorCorrectLevel?: 'L' | 'M' | 'Q' | 'H'; |
||||
typeNumber?: TypeNumber; |
||||
} |
||||
declare module 'yaqrcode' { |
||||
export default function qrcode(source: string, params?: Params): string; |
||||
} |
||||
Loading…
Reference in new issue