From c4a0ce99920a37375789854c166cf80d5ade999f Mon Sep 17 00:00:00 2001 From: leejinseok Date: Thu, 6 Feb 2020 15:23:49 +0900 Subject: [PATCH] formatting --- src/front/src/api/articleApi.js | 113 +++++++++-------- src/front/src/api/authApi.js | 66 +++++----- src/front/src/components/HelloWorld.vue | 58 --------- src/front/src/main.js | 4 +- src/front/src/middlewares/authentication.js | 20 --- src/front/src/pages/Welcome.vue | 33 ++--- src/front/src/pages/articles/Detail.vue | 71 ++++++----- src/front/src/pages/articles/List.vue | 53 ++++---- src/front/src/pages/articles/Write.vue | 92 +++++++------- src/front/src/pages/auth/Login.vue | 45 ++++--- src/front/src/pages/auth/Register.vue | 57 ++++----- src/front/src/pages/me/Info.vue | 15 ++- src/front/src/routes/index.js | 66 +++++----- src/front/src/services/articleService.js | 131 ++++++++++---------- src/front/src/services/authService.js | 84 ++++++------- src/front/src/utils/commonUtil.js | 7 +- 16 files changed, 418 insertions(+), 497 deletions(-) delete mode 100644 src/front/src/components/HelloWorld.vue delete mode 100644 src/front/src/middlewares/authentication.js diff --git a/src/front/src/api/articleApi.js b/src/front/src/api/articleApi.js index 4b3ae8f..f5c8e17 100644 --- a/src/front/src/api/articleApi.js +++ b/src/front/src/api/articleApi.js @@ -1,64 +1,63 @@ import axios from 'axios'; -import commonUtil from "../utils/commonUtil"; export default { - getArticles({page = 0, size = 10, q = ''}, authorization) { + getArticles({page = 0, size = 10, q = ''}, authorization) { - return axios({ - url: '/api/articles', - headers: { - 'Authorization': authorization - }, - params: { - page, - size, - q - } - }); - }, - getArticle({articleId}, authorization) { - return axios({ - url: '/api/articles/' + articleId, - headers: { - 'Authorization': authorization - } - }); - }, - postArticle({title = '', content = ''}, authorization) { + return axios({ + url: '/api/articles', + headers: { + 'Authorization': authorization + }, + params: { + page, + size, + q + } + }); + }, + getArticle({articleId}, authorization) { + return axios({ + url: '/api/articles/' + articleId, + headers: { + 'Authorization': authorization + } + }); + }, + postArticle({title = '', content = ''}, authorization) { - return axios({ - url: '/api/articles', - method: 'post', - headers: { - 'Authorization': authorization - }, - data: { - title, - content - } - }); - }, - updateArticle(id, {title = '', content = ''}, authorization) { - return axios({ - url: '/api/articles/' + id, - method: 'put', - headers: { - 'Authorization': authorization - }, - data: { - title, - content - } - }); - }, - removeArticle({articleId}, authorization) { + return axios({ + url: '/api/articles', + method: 'post', + headers: { + 'Authorization': authorization + }, + data: { + title, + content + } + }); + }, + updateArticle(id, {title = '', content = ''}, authorization) { + return axios({ + url: '/api/articles/' + id, + method: 'put', + headers: { + 'Authorization': authorization + }, + data: { + title, + content + } + }); + }, + removeArticle({articleId}, authorization) { - return axios({ - url: '/api/articles/' + articleId, - headers: { - 'Authorization': authorization - }, - method: 'delete' - }); - } + return axios({ + url: '/api/articles/' + articleId, + headers: { + 'Authorization': authorization + }, + method: 'delete' + }); + } } \ No newline at end of file diff --git a/src/front/src/api/authApi.js b/src/front/src/api/authApi.js index 7eeb851..fef9918 100644 --- a/src/front/src/api/authApi.js +++ b/src/front/src/api/authApi.js @@ -1,39 +1,37 @@ import axios from "axios"; -import commonUtil from "../utils/commonUtil"; - export default { - login(data) { - const { email, password } = data; - return axios({ - method: 'post', - url: '/api/auth/login', - data: { - email, - password - } - }); - }, - session(authorization) { - return axios({ - method: 'get', - url: '/api/users', - headers: { - 'Authorization': authorization - } - }); - }, - register(data) { - const { email, name, password } = data; - return axios({ - method: 'post', - url: '/api/auth/register', - data: { - email, - name, - password - } - }); - }, + login(data) { + const {email, password} = data; + return axios({ + method: 'post', + url: '/api/auth/login', + data: { + email, + password + } + }); + }, + session(authorization) { + return axios({ + method: 'get', + url: '/api/users', + headers: { + 'Authorization': authorization + } + }); + }, + register(data) { + const {email, name, password} = data; + return axios({ + method: 'post', + url: '/api/auth/register', + data: { + email, + name, + password + } + }); + }, } diff --git a/src/front/src/components/HelloWorld.vue b/src/front/src/components/HelloWorld.vue deleted file mode 100644 index 879051a..0000000 --- a/src/front/src/components/HelloWorld.vue +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - diff --git a/src/front/src/main.js b/src/front/src/main.js index 0ea96ad..685dbf3 100644 --- a/src/front/src/main.js +++ b/src/front/src/main.js @@ -8,6 +8,6 @@ Vue.config.productionTip = false; Vue.use(VueCookie); new Vue({ - render: h => h(App), - router + render: h => h(App), + router }).$mount('#app'); diff --git a/src/front/src/middlewares/authentication.js b/src/front/src/middlewares/authentication.js deleted file mode 100644 index 735e4e4..0000000 --- a/src/front/src/middlewares/authentication.js +++ /dev/null @@ -1,20 +0,0 @@ -import axios from "axios"; -import commonUtil from "../utils/commonUtil"; - -export default { - async session() { - try { - await axios({ - method: 'get', - url: '/api/users', - headers: { - 'Authorization': commonUtil.getAuthenticationHeaderBearer(this.$cookie.get('accessToken')) - } - }); - } catch (e) { - alert('토큰이 존재하지 않거나 유효하지 않은 토큰입니다.'); - await this.$router.replace('/'); - } - - } -} \ No newline at end of file diff --git a/src/front/src/pages/Welcome.vue b/src/front/src/pages/Welcome.vue index fa0123a..6c74099 100644 --- a/src/front/src/pages/Welcome.vue +++ b/src/front/src/pages/Welcome.vue @@ -1,8 +1,10 @@ \ No newline at end of file diff --git a/src/front/src/pages/articles/Detail.vue b/src/front/src/pages/articles/Detail.vue index c81ecc7..d273fe1 100644 --- a/src/front/src/pages/articles/Detail.vue +++ b/src/front/src/pages/articles/Detail.vue @@ -1,16 +1,18 @@ \ No newline at end of file diff --git a/src/front/src/pages/articles/List.vue b/src/front/src/pages/articles/List.vue index 3ef864e..16a580e 100644 --- a/src/front/src/pages/articles/List.vue +++ b/src/front/src/pages/articles/List.vue @@ -7,7 +7,7 @@ {{ article.user.name }} -
+
글쓰기 @@ -24,39 +24,40 @@ \ No newline at end of file diff --git a/src/front/src/pages/articles/Write.vue b/src/front/src/pages/articles/Write.vue index 0d30a47..2c1901a 100644 --- a/src/front/src/pages/articles/Write.vue +++ b/src/front/src/pages/articles/Write.vue @@ -3,7 +3,7 @@
- +
@@ -17,51 +17,57 @@ \ No newline at end of file diff --git a/src/front/src/pages/auth/Register.vue b/src/front/src/pages/auth/Register.vue index 8473388..2413848 100644 --- a/src/front/src/pages/auth/Register.vue +++ b/src/front/src/pages/auth/Register.vue @@ -1,9 +1,9 @@