mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-04-30 22:29:01 +08:00
40 lines
603 B
JavaScript
40 lines
603 B
JavaScript
import { defAxios as request } from '@/utils/http'
|
|
|
|
export function getPosts(params = {}) {
|
|
return request({
|
|
url: '/posts',
|
|
method: 'get',
|
|
params,
|
|
})
|
|
}
|
|
|
|
export function getPostById({ id }) {
|
|
return request({
|
|
url: `/post/${id}`,
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
export function savePost(id, data = {}) {
|
|
if (id) {
|
|
return request({
|
|
url: `/post/${id}`,
|
|
method: 'put',
|
|
data,
|
|
})
|
|
}
|
|
|
|
return request({
|
|
url: '/post',
|
|
method: 'post',
|
|
data,
|
|
})
|
|
}
|
|
|
|
export function deletePost(id) {
|
|
return request({
|
|
url: `/post/${id}`,
|
|
method: 'delete',
|
|
})
|
|
}
|