From 189a541e959dbe932f71bdf9c0b90b12656451c4 Mon Sep 17 00:00:00 2001 From: leejinseok Date: Fri, 14 Feb 2020 11:54:57 +0900 Subject: [PATCH] update --- src/front/src/api/articleApi.js | 18 +++++++++--------- src/front/src/services/articleService.js | 8 +++++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/front/src/api/articleApi.js b/src/front/src/api/articleApi.js index 7c1aeb2..6c4cc21 100644 --- a/src/front/src/api/articleApi.js +++ b/src/front/src/api/articleApi.js @@ -3,37 +3,37 @@ import axios from 'axios'; export default { getArticles({page = 0, size = 10, q = ''}, authorization) { - const request = axios({ + const options = { url: '/api/articles', params: { page, size, q } - }); + }; if (authorization) { - request.headers = { + options.headers = { 'Authorization': authorization }; } - return request; + return axios(options); }, getArticle({articleId}, authorization) { - const request = axios({ + const options = { url: '/api/articles/' + articleId, - - }); + }; if (authorization) { - request.headeres = { + options.headers = { 'Authorization': authorization } } - return request; + console.log(options); + return axios(options); }, postArticle({title = '', content = ''}, authorization) { diff --git a/src/front/src/services/articleService.js b/src/front/src/services/articleService.js index 26196a2..b9d5d4c 100644 --- a/src/front/src/services/articleService.js +++ b/src/front/src/services/articleService.js @@ -20,9 +20,11 @@ export default { }, async getArticle(articleId) { try { - const authorization = commonUtil.getAuthenticationHeaderBearer(this.$cookie.get('accessToken')); - const result = await articleApi.getArticle({articleId}, authorization); - return result.data; + const accessToken = this.$cookie.get('accessToken'); + const authorization = commonUtil.getAuthenticationHeaderBearer(accessToken); + + const {data} = await articleApi.getArticle({articleId}, authorization); + return data; } catch (err) { alert('문제가 발생하였습니다.'); console.log(err);