added getUserDeatils api

This commit is contained in:
Abhinav-grd 2021-08-05 09:49:04 +05:30
parent ab325dce59
commit b1798fd5b3

View file

@ -8,6 +8,7 @@ import { getToken } from 'utils/common/key';
import HTTPService from './HTTPService';
import { B64EncryptionResult } from './uploadService';
import { logError } from 'utils/sentry';
import { Subscription } from './billingService';
export interface UpdatedKey {
kekSalt: string;
@ -55,6 +56,14 @@ export interface TwoFactorRecoveryResponse {
secretDecryptionNonce: string
}
export interface UserDetails{
email:string;
usage:string;
fileCount:number;
sharedCollectionCount:number;
subscription:Subscription;
}
export const getOtt = (email: string) => HTTPService.get(`${ENDPOINT}/users/ott`, {
email,
client: 'web',
@ -208,3 +217,16 @@ export const changeEmail=async (email:string, ott:string)=>{
'X-Auth-Token': getToken(),
});
};
export const getUserDetails = async ():Promise<UserDetails> => {
const token = getToken();
const resp = await HTTPService.get(
`${ENDPOINT}/users/details`,
null,
{
'X-Auth-Token': token,
},
);
return resp.data['details'];
};