From c897dcd7790a2c5ef6f05f459695e3d4f05f964e Mon Sep 17 00:00:00 2001 From: johnniang Date: Mon, 25 Mar 2019 23:27:25 +0800 Subject: [PATCH] Complete TagList with api --- src/api/tag.js | 30 +++++++--- src/views/post/TagList.vue | 117 +++++++++++++++++++++++++------------ 2 files changed, 100 insertions(+), 47 deletions(-) diff --git a/src/api/tag.js b/src/api/tag.js index 64580e9c..9a4de04a 100644 --- a/src/api/tag.js +++ b/src/api/tag.js @@ -4,25 +4,37 @@ const baseUrl = '/admin/api/tags' const tagApi = {} -tagApi.listAll = () => { +tagApi.listAll = (more = false) => { return service({ url: baseUrl, - method: 'get' - }) -} - -tagApi.listAllAddition = () => { - return service({ - url: `${baseUrl}/addition`, + params: { + more: more + }, method: 'get' }) } tagApi.create = tag => { return service({ - url: `${baseUrl}`, + url: baseUrl, + data: tag, method: 'post' }) } +tagApi.update = (tagId, tag) => { + return service({ + url: `${baseUrl}/${tagId}`, + data: tag, + method: 'put' + }) +} + +tagApi.delete = tagId => { + return service({ + url: `${baseUrl}/${tagId}`, + method: 'delete' + }) +} + export default tagApi diff --git a/src/views/post/TagList.vue b/src/views/post/TagList.vue index 44d89131..4228beb0 100644 --- a/src/views/post/TagList.vue +++ b/src/views/post/TagList.vue @@ -1,52 +1,59 @@