
--- client/views/pages/AppRouter.js
+++ client/views/pages/AppRouter.js
... | ... | @@ -40,4 +40,37 @@ |
40 | 40 |
routes, |
41 | 41 |
}); |
42 | 42 |
|
43 |
+// AppRouter.beforeEach(async (to, from, next)=>{ |
|
44 |
+// const userId = store.state.loginUser; |
|
45 |
+ |
|
46 |
+// if(userId == null && to.path != '/login.page'){ |
|
47 |
+// var vm = this; |
|
48 |
+// axios({ |
|
49 |
+// url: '/getLoginInfo.json', |
|
50 |
+// method: 'post', |
|
51 |
+// headers: { |
|
52 |
+// 'Content-Type': 'application/json; charset=UTF-8' |
|
53 |
+// } |
|
54 |
+// }).then(function (response) { |
|
55 |
+// // 로그인 정보 있음 |
|
56 |
+// if(response.data.checkMessage.status > 0){ |
|
57 |
+// store.commit('setLoginUser',response.data.resultData.LoginUserInfo); |
|
58 |
+// next() |
|
59 |
+// }else{ |
|
60 |
+// next('/login.page') |
|
61 |
+// } |
|
62 |
+// }).catch(function (error) { |
|
63 |
+// console.log(error); |
|
64 |
+// }); |
|
65 |
+// }else{ |
|
66 |
+// if(to.path == '/login.page' && userId == null){ |
|
67 |
+// next() |
|
68 |
+// }else if(to.path != '/login.page' && userId == null){ |
|
69 |
+// next('/login.page') |
|
70 |
+// }else{ |
|
71 |
+// next() |
|
72 |
+// } |
|
73 |
+// } |
|
74 |
+// }) |
|
75 |
+ |
|
43 | 76 |
export default AppRouter; |
+++ client/views/pages/AppStore.js
... | ... | @@ -0,0 +1,24 @@ |
1 | +import { createStore } from 'vuex'; | |
2 | + | |
3 | +export default createStore ({ | |
4 | + state: { | |
5 | + loginUser: null, | |
6 | + key:null, | |
7 | + }, | |
8 | + getters: { | |
9 | + getLoginUser: function () { | |
10 | + | |
11 | + }, | |
12 | + getKey: function () { | |
13 | + | |
14 | + } | |
15 | + }, | |
16 | + mutations: { | |
17 | + setLoginUser: function (state, newValue) { | |
18 | + state.loginUser = newValue; | |
19 | + }, | |
20 | + setKey: function (state, newValue) { | |
21 | + state.key = newValue; | |
22 | + } | |
23 | + } | |
24 | +});(파일 끝에 줄바꿈 문자 없음) |
--- package-lock.json
+++ package-lock.json
... | ... | @@ -16,11 +16,13 @@ |
16 | 16 |
"express-http-proxy": "^1.6.3", |
17 | 17 |
"file-loader": "^6.2.0", |
18 | 18 |
"fs": "^0.0.1-security", |
19 |
+ "js-cookie": "^3.0.5", |
|
19 | 20 |
"new-line": "^1.1.1", |
20 | 21 |
"vue": "^3.3.4", |
21 | 22 |
"vue-loader": "^17.2.2", |
22 | 23 |
"vue-router": "^4.2.4", |
23 | 24 |
"vue-style-loader": "^4.1.3", |
25 |
+ "vuex": "^4.1.0", |
|
24 | 26 |
"webpack": "^5.88.2", |
25 | 27 |
"webpack-cli": "^5.1.4" |
26 | 28 |
} |
... | ... | @@ -2141,6 +2143,14 @@ |
2141 | 2143 |
"url": "https://github.com/chalk/supports-color?sponsor=1" |
2142 | 2144 |
} |
2143 | 2145 |
}, |
2146 |
+ "node_modules/js-cookie": { |
|
2147 |
+ "version": "3.0.5", |
|
2148 |
+ "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", |
|
2149 |
+ "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", |
|
2150 |
+ "engines": { |
|
2151 |
+ "node": ">=14" |
|
2152 |
+ } |
|
2153 |
+ }, |
|
2144 | 2154 |
"node_modules/js-tokens": { |
2145 | 2155 |
"version": "4.0.0", |
2146 | 2156 |
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", |
... | ... | @@ -3339,6 +3349,17 @@ |
3339 | 3349 |
}, |
3340 | 3350 |
"engines": { |
3341 | 3351 |
"node": ">=4.0.0" |
3352 |
+ } |
|
3353 |
+ }, |
|
3354 |
+ "node_modules/vuex": { |
|
3355 |
+ "version": "4.1.0", |
|
3356 |
+ "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz", |
|
3357 |
+ "integrity": "sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==", |
|
3358 |
+ "dependencies": { |
|
3359 |
+ "@vue/devtools-api": "^6.0.0-beta.11" |
|
3360 |
+ }, |
|
3361 |
+ "peerDependencies": { |
|
3362 |
+ "vue": "^3.2.0" |
|
3342 | 3363 |
} |
3343 | 3364 |
}, |
3344 | 3365 |
"node_modules/watchpack": { |
... | ... | @@ -5132,6 +5153,11 @@ |
5132 | 5153 |
} |
5133 | 5154 |
} |
5134 | 5155 |
}, |
5156 |
+ "js-cookie": { |
|
5157 |
+ "version": "3.0.5", |
|
5158 |
+ "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", |
|
5159 |
+ "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==" |
|
5160 |
+ }, |
|
5135 | 5161 |
"js-tokens": { |
5136 | 5162 |
"version": "4.0.0", |
5137 | 5163 |
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", |
... | ... | @@ -5945,6 +5971,14 @@ |
5945 | 5971 |
} |
5946 | 5972 |
} |
5947 | 5973 |
}, |
5974 |
+ "vuex": { |
|
5975 |
+ "version": "4.1.0", |
|
5976 |
+ "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz", |
|
5977 |
+ "integrity": "sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==", |
|
5978 |
+ "requires": { |
|
5979 |
+ "@vue/devtools-api": "^6.0.0-beta.11" |
|
5980 |
+ } |
|
5981 |
+ }, |
|
5948 | 5982 |
"watchpack": { |
5949 | 5983 |
"version": "2.4.0", |
5950 | 5984 |
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", |
--- package.json
+++ package.json
... | ... | @@ -11,11 +11,13 @@ |
11 | 11 |
"express-http-proxy": "^1.6.3", |
12 | 12 |
"file-loader": "^6.2.0", |
13 | 13 |
"fs": "^0.0.1-security", |
14 |
+ "js-cookie": "^3.0.5", |
|
14 | 15 |
"new-line": "^1.1.1", |
15 | 16 |
"vue": "^3.3.4", |
16 | 17 |
"vue-loader": "^17.2.2", |
17 | 18 |
"vue-router": "^4.2.4", |
18 | 19 |
"vue-style-loader": "^4.1.3", |
20 |
+ "vuex": "^4.1.0", |
|
19 | 21 |
"webpack": "^5.88.2", |
20 | 22 |
"webpack-cli": "^5.1.4" |
21 | 23 |
}, |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?