Skip to content

Commit b014f10

Browse files
committed
fix: #916
1 parent d3a417a commit b014f10

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/components/pages/settings/parts/SettingsMfa/TwoFAButton.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export default function TwoFAButton() {
2727

2828
const [totpOpen, setTotpOpen] = useState(false);
2929
const {
30-
data: twoData,
31-
error: twoError,
32-
isLoading: twoLoading,
30+
data: mfaData,
31+
error: mfaError,
32+
isLoading: mfaLoading,
3333
} = useSWR<Extract<Response['/api/user/mfa/totp'], { secret: string; qrcode: string }>>(
3434
totpOpen && !user?.totpSecret ? '/api/user/mfa/totp' : null,
3535
null,
@@ -51,7 +51,7 @@ export default function TwoFAButton() {
5151
'POST',
5252
{
5353
code: pin,
54-
secret: twoData!.secret,
54+
secret: mfaData!.secret,
5555
},
5656
);
5757

@@ -156,25 +156,20 @@ export default function TwoFAButton() {
156156
</Text>
157157

158158
<Box pos='relative'>
159-
{twoLoading && !twoError ? (
159+
{mfaLoading && !mfaError ? (
160160
<Box w={180} h={180}>
161161
<LoadingOverlay visible pos='relative' />
162162
</Box>
163163
) : (
164164
<Center>
165-
<Image
166-
width={180}
167-
height={180}
168-
src={twoData?.qrcode}
169-
alt={'qr code ' + twoData?.secret}
170-
/>
165+
<Image h={180} w={180} src={mfaData?.qrcode} alt={'qr code ' + mfaData?.secret} />
171166
</Center>
172167
)}
173168
</Box>
174169

175170
<Text size='sm' c='dimmed'>
176171
If you can&apos;t scan the QR code, you can manually enter the following code into your
177-
authenticator app: <Code>{twoData?.secret ?? ''}</Code>
172+
authenticator app: <Code>{mfaData?.secret ?? ''}</Code>
178173
</Text>
179174

180175
<Text size='sm' c='dimmed'>

0 commit comments

Comments
 (0)