import API from './Api';
const axios = require('axios');

export const login = (params: any) => {
  return API.post('member-login', params);
};

export const register = (params: any) => {
  return API.post('register-member', params);
};

export const getProfile = () => {
  return API.get('member-details');
};

export const updateProfile = (params: any) => {
  const header = axios.defaults.headers.common;
  header['Cache-Control'] = 'no-cache';
  header['Content-Type'] = 'multipart/form-data';
  return API.post('update-member-profile', params, header);
};

export const forgotPassword = (params: any) => {
  return API.post('send-reset-member-password-link', params);
};

export const resetPassword = (params: any) => {
  return API.post('reset-member-password', params);
};

export const changePassword = (params: any) => {
 return API.put('change-password', params);
};

export const logout = () => {
  return API.post('logout');
};

export const uploadProfileImage = (userID: string, file: any) => {
  const header = axios.defaults.headers.common;
  header['Cache-Control'] = 'no-cache';
  header['Content-Type'] = 'multipart/form-data';
  const params = new FormData();
  params.append('file', file);
  return API.post('update-member-profil', params, header);
};
