import http from '@/http/yskApi/http.js'
const request = http.request

/**
 * 获取分类分页
 * @returns
 */
export function categoryPage(data, urlType = 'product') {
	return request({
		url: `/${urlType}/admin/prod/category/page`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 分类添加
 * @returns
 */
export function addCategory(data, urlType = 'product') {
	return request({
		url: `/${urlType}/admin/prod/category`,
		method: "POST",
		data: {
			...data
		}
	})
}

/**
 * 分类修改
 * @returns
 */
export function putCategory(data, urlType = 'product') {
	return request({
		url: `/${urlType}/admin/prod/category`,
		method: "PUT",
		data: {
			...data
		}
	})
}

/**
 * 分类删除
 * @returns
 */
export function delCategory(id, urlType = 'product') {
	return request({
		url: `/${urlType}/admin/prod/category/${id}`,
		method: "DELETE",
	})
}