From b1798fd5b330fc66f962b469c248a43babe94723 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Thu, 5 Aug 2021 09:49:04 +0530 Subject: [PATCH] added getUserDeatils api --- src/services/userService.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/services/userService.ts b/src/services/userService.ts index 733c1bcf8..c52c2a04a 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -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 => { + const token = getToken(); + + const resp = await HTTPService.get( + `${ENDPOINT}/users/details`, + null, + { + 'X-Auth-Token': token, + }, + ); + return resp.data['details']; +};