import httpService from '../../core/services/http.service' ; import { UserSettings } from '../types' ; export interface InitializeUserResponse { user : { email : string ; bucket : string ; mnemonic : string ; root_folder_id : number ; } ; } export async function initializeUser ( email , mnemonic ) { return httpService . post < { email : string ; mnemonic : string ; } , InitializeUserResponse | undefined > ( '/api/initialize' , { email , mnemonic , } ) ; } export const sendDeactivationEmail = ( email ) : Promise < void > => { return httpService . get < void > ( `/api/reset/${ email }` ) ; } ; const inviteAFriend = ( email ) : Promise < void > => { return httpService . post < { email : string ; } , void > ( '/api/user/invite' , { email } ) ; } ; /**
 * ! This endpoint accepts a body but is using GET method
 */ const refreshUser = async ( ) : Promise < { user : UserSettings ; token : string ; } > => { return httpService . get < { user : UserSettings ; token : string ; } > ( '/api/user/refresh' ) ; } ; const userService = { initializeUser , refreshUser , sendDeactivationEmail , inviteAFriend , } ; export default userService ;