87 lines
1.7 KiB
JavaScript
Vendored
87 lines
1.7 KiB
JavaScript
Vendored
/**
|
|
* 取得媒體分類
|
|
*
|
|
* 參數:
|
|
* category_id: 分類ID
|
|
* media_ids: 媒體的ID字串(使用逗號分隔)
|
|
*
|
|
* Response:
|
|
* mediaCategories: 分類資料
|
|
*/
|
|
export const index = (data = {}) => {
|
|
return axios.get(app.admin.ajax.resource.mediaCategory.index, {params: data});
|
|
}
|
|
/**
|
|
* 新增媒體分類
|
|
*
|
|
* 參數:
|
|
* name: 名稱
|
|
*
|
|
* Success Response:
|
|
* mediaCategory: 被新增的分類
|
|
* message: 訊息
|
|
*
|
|
* Error Response:
|
|
* message: 訊息
|
|
*/
|
|
export const add = (name, data = {}) => {
|
|
data = Object.assign({
|
|
name: name
|
|
}, data);
|
|
return axios.post(app.admin.ajax.resource.mediaCategory.add, data);
|
|
}
|
|
/**
|
|
* 更新媒體分類名稱
|
|
*
|
|
* 參數:
|
|
* id: 分類ID
|
|
* name: 名稱
|
|
*
|
|
* Success Response:
|
|
* id: 分類ID
|
|
* name: 分類名稱
|
|
* message: 訊息
|
|
*
|
|
* Error Response:
|
|
* message: 訊息
|
|
*/
|
|
export const update = (id, name, data = {}) => {
|
|
data = Object.assign({
|
|
name: name
|
|
}, data);
|
|
return axios.put(app.admin.ajax.resource.mediaCategory.update.replace(':id', id), data);
|
|
}
|
|
/**
|
|
* 更新媒體分類排序
|
|
*
|
|
* 參數:
|
|
* ids: 分類id(以逗號分隔)
|
|
*
|
|
*
|
|
* Error Response:
|
|
* message: 訊息
|
|
*/
|
|
export const updateOrder = (ids, data = {}) => {
|
|
data = Object.assign({
|
|
ids: ids
|
|
}, data);
|
|
return axios.put(app.admin.ajax.resource.mediaCategory.updateOrder, data);
|
|
}
|
|
/**
|
|
* 刪除媒體分類
|
|
*
|
|
* 參數:
|
|
* id: 分類ID
|
|
*
|
|
* Success Response:
|
|
* id: 分類ID
|
|
* count: 該媒體分類所有的媒體數量
|
|
* message: 訊息
|
|
*
|
|
* Error Response:
|
|
* message: 訊息
|
|
*/
|
|
export const destroy = (id, data = {}) => {
|
|
return axios.delete(app.admin.ajax.resource.mediaCategory.destroy.replace(':id', id), data);
|
|
}
|