import {PostLogin, PostData, GetData, PostFormData} from '../helpers';

import url from '../url';

export const loginApi = async (body) =>
  PostLogin(url.urllogin, body)
    .then((res) => res)
    .catch((err) => err);

export const registorApi = async (body) =>
  PostLogin(url.urlRegistor, body)
    .then((res) => res)
    .catch((err) => err);

export const logoutApi = async (body) =>
  PostData(urlLogout, body)
    .then((res) => res)
    .catch((err) => err);

export const getOTPApi = async (body) =>
  PostLogin(url.urlGetOTP, body)
    .then((res) => res)
    .catch((err) => err);

export const verifyOTPApi = async (body) =>
  PostLogin(url.urlVerifyOTP, body)
    .then((res) => res)
    .catch((err) => err);

export const forgotPasswordApi = async (body) =>
  PostLogin(url.urlForgotPassword, body)
    .then((res) => res)
    .catch((err) => err);

export const verifyAccountApi = async (body) =>
  PostData(url.urlVerifyAccount, body)
    .then((res) => res)
    .catch((err) => err);

export const getTransaction = async (body) =>
  GetData(url.urlGetTransaction, body)
    .then((res) => res)
    .catch((err) => err);

export const getListNotification = async (body) =>
  GetData(url.urlGetListNotification, body)
    .then((res) => res)
    .catch((err) => err);

export const updateInforUser = async (body) =>
  PostData(url.urlUpdateInforUser, body)
    .then((res) => res)
    .catch((err) => err);

export const updateLangugeApi = async (body) =>
  PostData(url.urlUpdateLanguage, body)
    .then((res) => res)
    .catch((err) => err);

export const getDetailUser = async (body) =>
  GetData(url.urlGetDetailUser, body)
    .then((res) => res)
    .catch((err) => err);

export const getNewestVersionInfo = async (body) =>
  GetData(url.urlGetNewestVersionInfo, body)
    .then((res) => res)
    .catch((err) => err);

export const changeAvatart = async (body) =>
  PostFormData(url.urlChangeAvatar, body)
    .then((res) => res)
    .catch((err) => err);

export const getOTPApiSmartOTP = async (body) =>
  PostLogin(url.urlGetSmartOTP, body)
    .then((res) => res)
    .catch((err) => err);

export const verifyStoreOTPApiSmart = async (body) =>
  PostData(url.urlStoreOTPSmart, body)
    .then((res) => res)
    .catch((err) => err);

export const verifyOTPApiSmart = async (body) =>
  PostData(url.urlVerufySmartOTP, body)
    .then((res) => res)
    .catch((err) => err);

export const updateOTPApiSmart = async (body) =>
  PostData(url.urlUpdateSmartOTP, body)
    .then((res) => res)
    .catch((err) => err);

export const verifyPassword = async (body) =>
  PostData(url.urlVerifyPassword, body)
    .then((res) => res)
    .catch((err) => err);
