This commit is contained in:
Manav Rathi 2024-05-25 16:24:52 +05:30
parent 314c8f69f2
commit 621c482529
No known key found for this signature in database
3 changed files with 18 additions and 17 deletions

View file

@ -127,7 +127,7 @@ export const updateSRPAndKeys = async (
const resp = await HTTPService.post(
`${ENDPOINT}/users/srp/update`,
updateSRPAndKeyRequest,
null,
undefined,
{
"X-Auth-Token": token,
},

View file

@ -66,14 +66,10 @@ export const logout = async () => {
};
export const verifyTwoFactor = async (code: string, sessionID: string) => {
const resp = await HTTPService.post(
`${ENDPOINT}/users/two-factor/verify`,
{
code,
sessionID,
},
null,
);
const resp = await HTTPService.post(`${ENDPOINT}/users/two-factor/verify`, {
code,
sessionID,
});
return resp.data as UserVerificationResponse;
};
@ -108,7 +104,7 @@ export const changeEmail = async (email: string, ott: string) => {
email,
ott,
},
null,
undefined,
{
"X-Auth-Token": getToken(),
},
@ -127,7 +123,7 @@ export const setupTwoFactor = async () => {
const resp = await HTTPService.post(
`${ENDPOINT}/users/two-factor/setup`,
null,
null,
undefined,
{
"X-Auth-Token": getToken(),
},
@ -148,7 +144,7 @@ export const enableTwoFactor = async (
twoFactorSecretDecryptionNonce:
recoveryEncryptedTwoFactorSecret.nonce,
},
null,
undefined,
{
"X-Auth-Token": getToken(),
},
@ -156,12 +152,17 @@ export const enableTwoFactor = async (
};
export const setRecoveryKey = (token: string, recoveryKey: RecoveryKey) =>
HTTPService.put(`${ENDPOINT}/users/recovery-key`, recoveryKey, null, {
HTTPService.put(`${ENDPOINT}/users/recovery-key`, recoveryKey, undefined, {
"X-Auth-Token": token,
});
export const disableTwoFactor = async () => {
await HTTPService.post(`${ENDPOINT}/users/two-factor/disable`, null, null, {
"X-Auth-Token": getToken(),
});
await HTTPService.post(
`${ENDPOINT}/users/two-factor/disable`,
null,
undefined,
{
"X-Auth-Token": getToken(),
},
);
};

View file

@ -24,7 +24,7 @@ interface formValues {
function ChangeEmailForm({ appName }: PageProps) {
const [loading, setLoading] = useState(false);
const [ottInputVisible, setShowOttInputVisibility] = useState(false);
const [email, setEmail] = useState(null);
const [email, setEmail] = useState<string | null>(null);
const [showMessage, setShowMessage] = useState(false);
const [success, setSuccess] = useState(false);