import { httpGet, httpPost } from '@/apis'

export const getModel : Function = (url : string) => {
	return function (params : object) {
		return new Promise((resolve, reject) => {
			httpGet(url, params, function (response) {
				if (response.data.code == 0) {
					resolve(response.data)
				} else {
					reject(response)
				}
			})
		})
	}
}

export const postModel : Function = (url : string) => {
	return function (params : object) {
		return new Promise((resolve, reject) => {
			httpPost(url, params, function (response) {
				if (response.data.code == 0) {
					resolve(response.data)
				} else {
					reject(response)
				}
			})
		})
	}
}

