From dcd27758f76a55409dfd0f6d161b32f7688172c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=8C=E1=85=B5=E1=86=AB=E1=84=89?= =?UTF-8?q?=E1=85=A5=E1=86=A8?= Date: Thu, 6 Feb 2020 12:48:01 +0900 Subject: [PATCH] =?UTF-8?q?=EC=96=B4=EB=A0=B5=EB=8B=A4=20=EC=96=B4?= =?UTF-8?q?=EB=A0=A4=EC=9B=8C=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/pages/articles/Detail.vue | 5 ++--- src/front/src/pages/articles/List.vue | 3 ++- src/front/src/services/articleService.js | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/front/src/pages/articles/Detail.vue b/src/front/src/pages/articles/Detail.vue index cc2fed3..94ac5da 100644 --- a/src/front/src/pages/articles/Detail.vue +++ b/src/front/src/pages/articles/Detail.vue @@ -40,9 +40,8 @@ articleService.removeArticle = articleService.removeArticle.bind(this); }, async created() { - - - await articleService.getArticle(this.$route.params.id); + this.article = await articleService.getArticle(this.$route.params.id); + this.init = true; }, methods: { async remove() { diff --git a/src/front/src/pages/articles/List.vue b/src/front/src/pages/articles/List.vue index f0616f7..52fe27a 100644 --- a/src/front/src/pages/articles/List.vue +++ b/src/front/src/pages/articles/List.vue @@ -46,7 +46,8 @@ }, async created() { await authService.banishIfUserUnAuthenticated(); - await articleService.getArticles({}); + this.articles = await articleService.getArticles({}); + this.pending = false; }, methods: { async logout() { diff --git a/src/front/src/services/articleService.js b/src/front/src/services/articleService.js index 44b8e67..b0bf3b2 100644 --- a/src/front/src/services/articleService.js +++ b/src/front/src/services/articleService.js @@ -5,8 +5,7 @@ export default { async getArticles({page = 0, size = 10}) { try { const result = await articleApi.getArticles({page, size}, commonUtil.getAuthenticationHeaderBearer(this.$cookie.get('accessToken'))); - this.articles = result.data; - this.pending = false; + return result.data; } catch (err) { alert('문제가 발생하였습니다.'); console.log(err.response); @@ -16,9 +15,7 @@ export default { try { const authorization = commonUtil.getAuthenticationHeaderBearer(this.$cookie.get('accessToken')); const result = await articleApi.getArticle({articleId}, authorization); - this.article = result.data; - this.init = true; - + return result.data; } catch (e) { alert('문제가 발생하였습니다.'); console.log(e);