From edf95221715b2d0bcdb2a4a3eff4dc3d5407283f Mon Sep 17 00:00:00 2001 From: johnniang Date: Thu, 21 Mar 2019 10:25:55 +0800 Subject: [PATCH] Complete post api and comment api --- .prettierrc | 5 + package.json | 4 + src/api/comment.js | 14 +++ src/api/post.js | 9 ++ src/views/dashboard/Dashboard.vue | 181 ++++++++++++++++-------------- 5 files changed, 130 insertions(+), 83 deletions(-) create mode 100644 .prettierrc create mode 100644 src/api/comment.js diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..cbe842ac --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "printWidth": 120, + "semi": false, + "singleQuote": true +} diff --git a/package.json b/package.json index a6c601b5..c0d5dd1c 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,10 @@ "parser": "babel-eslint" }, "rules": { + "space-before-function-paren": [ + "error", + "never" + ], "generator-star-spacing": "off", "no-mixed-operators": 0, "vue/max-attributes-per-line": [ diff --git a/src/api/comment.js b/src/api/comment.js new file mode 100644 index 00000000..ba05c67c --- /dev/null +++ b/src/api/comment.js @@ -0,0 +1,14 @@ +import service from '@/utils/service' + +const baseUrl = '/admin/api/comments' + +const commentApi = {} + +commentApi.listLatest = () => { + return service({ + url: `${baseUrl}/latest`, + method: 'get' + }) +} + +export default commentApi diff --git a/src/api/post.js b/src/api/post.js index 884c80f0..23b09aa6 100644 --- a/src/api/post.js +++ b/src/api/post.js @@ -1,5 +1,14 @@ import service from '@/utils/service' +const baseUrl = '/admin/api/posts' + const postApi = {} +postApi.listLatest = () => { + return service({ + url: `${baseUrl}/latest`, + method: 'get' + }) +} + export default postApi diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 0d09d0df..e53e5abd 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -1,17 +1,45 @@