/* eslint-disable handle-callback-err */
import { PostData, GetURL } from '../helpers'
import url from '../url'

export const getListMerchants = async (body) =>
    PostData(url.urlGetListMerchant, body)
        .then((res) => res)
        .catch((err) => null)

export const createMerchant = async (body) =>
    PostData(url.urlCreateMerchant, body)
        .then((res) => res)
        .catch((err) => null)

export const updateMerchant = async (body) =>
    PostData(url.urlUpdateMerchant, body)
        .then((res) => res)
        .catch((err) => null)

export const detailMerchant = async (id, body) =>
    GetURL(`${url.urlDetailMerchant}/${id}`, body)
        .then((res) => res)
        .catch((err) => null)

export const deleteMerchant = async (body) =>
    PostData(url.urlDeleteMerchant, body)
        .then((res) => res)
        .catch((err) => null)
export const changeStatusMerchant = async (body) =>
    PostData(url.changeStatusMerchant, body)
        .then((res) => res)
        .catch((err) => null)

//
export const getListGasStation = async (body) =>
    PostData(url.urlGetListGasStation, body)
        .then((res) => res)
        .catch((err) => null)

export const createGasStation = async (body) =>
    PostData(url.urlCreateGasStation, body)
        .then((res) => res)
        .catch((err) => null)

export const updateGasStation = async (body) =>
    PostData(url.urlUpdateGasStation, body)
        .then((res) => res)
        .catch((err) => null)

export const detailGasStation = async (id, body) =>
    GetURL(`${url.urlDetailGasStation}/${id}`, body)
        .then((res) => res)
        .catch((err) => null)

export const deleteGasStation = async (body) =>
    PostData(url.urlDeleteGasStation, body)
        .then((res) => res)
        .catch((err) => null)
export const changeStatusGasStation = async (body) =>
    PostData(url.changeStatusGasStation, body)
        .then((res) => res)
        .catch((err) => null)

export const deleteGasOnline = async (body) =>
    PostData(url.deleteGasOnline, body)
        .then((res) => res)
        .catch((err) => null)

export const deleteGasField = async (body) =>
    PostData(url.deleteGasField, body)
        .then((res) => res)
        .catch((err) => null)

export const changeStatusStore = async (body) =>
    PostData(url.changeStatusStore, body)
        .then((res) => res)
        .catch((err) => null)
