mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-12-28 20:10:22 +08:00
refactor: refactor api usage
This commit is contained in:
13
src/views/examples/table/post/api.js
Normal file
13
src/views/examples/table/post/api.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import request from '@/utils/http'
|
||||
|
||||
export default {
|
||||
getPosts: (params = {}) => request.get('posts', params),
|
||||
getPostById: (id) => request.get(`/post/${id}`),
|
||||
savePost: (id, data = {}) => {
|
||||
if (id) {
|
||||
return request.put(`/post/${id}`, data)
|
||||
}
|
||||
return request.post('/post', data)
|
||||
},
|
||||
deletePost: (id) => request.delete(`/post/${id}`),
|
||||
}
|
||||
Reference in New Issue
Block a user