{"size": 1522, "ext": "js", "max_stars_repo_path": "app/dataService/Login.js", "max_stars_repo_name": "aman-anand/GURU", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/dataService/Login.js", "max_issues_repo_name": "aman-anand/GURU", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/dataService/Login.js", "max_forks_repo_name": "aman-anand/GURU", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 39.0256410256, "max_line_length": 100, "alphanum_fraction": 0.6780551905}
import { SEND_OTP, VERIFY_OTP, RETRY_OTP, SIGN_IN, REGISTER, UPDATE } from '../constants/endpoints';
import { makeHttpRequest as makeHttpCall } from './common/HttpProvider';
import { getFromLocalStore } from '../services/CommonSetterGetter';

export const SEND_OTP_API = (params, hideLoader) => {
  const config = { url: SEND_OTP(), data: params, method: 'POST', hideLoader };
  return makeHttpCall(config);
};
export const VERIFY_OTP_API = (params, hideLoader) => {
  const config = { url: VERIFY_OTP(), data: params, method: 'POST', hideLoader };
  return makeHttpCall(config);
};
export const RETRY_OTP_API = (params, hideLoader) => {
  const config = { url: RETRY_OTP(), data: params, method: 'POST', hideLoader };
  return makeHttpCall(config);
};

export const SIGN_IN_API = (params, hideLoader) => {
  const config = { url: SIGN_IN(), data: params, method: 'POST', hideLoader };
  return makeHttpCall(config);
};

export const SIGN_UP_API = (params, hideLoader) => {
  const config = { url: REGISTER(), data: params, method: 'POST', hideLoader };
  return makeHttpCall(config);
};

export const UPDATE_DETAILS = (params, hideLoader) => {
  const config = { url: UPDATE(), data: params, method: 'PUT', hideLoader };
  return makeHttpCall(config);
};

export const isUserAlreadyLogin = () => {
  const store = getFromLocalStore(['token', 'id', 'role', 'expires', 'phone']);
  const { token, id, role, expires, phone } = store || {};
  const auth = !!token && !!id && !!role && !!expires && !!phone;
  return auth;
};
