add getAccountDeleteChallenge api

This commit is contained in:
Abhinav 2022-09-05 21:14:08 +05:30
parent 815111890b
commit aafc3af100
2 changed files with 24 additions and 0 deletions

View file

@ -16,6 +16,7 @@ import {
TwoFactorVerificationResponse,
TwoFactorRecoveryResponse,
UserDetails,
DeleteChallengeResponse,
} from 'types/user';
import { getLocalFamilyData, isPartOfFamily } from 'utils/billing';
import { ServerErrorCodes } from 'utils/error';
@ -324,3 +325,21 @@ export const getFamilyPortalRedirectURL = async () => {
throw e;
}
};
export const getAccountDeleteChallenge = async () => {
try {
const token = getToken();
const resp = await HTTPService.get(
`${ENDPOINT}/users/delete-challenge`,
null,
{
'X-Auth-Token': token,
}
);
return resp.data as DeleteChallengeResponse;
} catch (e) {
logError(e, 'failed to get roadmap url');
throw e;
}
};

View file

@ -87,3 +87,8 @@ export interface UserDetails {
subscription: Subscription;
familyData?: FamilyData;
}
export interface DeleteChallengeResponse {
allowDelete: boolean;
encryptedChallenge: string;
}