Commit cd675153 authored by KangMin An's avatar KangMin An
Browse files

Update: 비로그인 시 기본 사용자 지역코드 반환 코드 추가.

parent 8866a1c9
...@@ -209,12 +209,12 @@ export const getConfirm = async (req, res) => { ...@@ -209,12 +209,12 @@ export const getConfirm = async (req, res) => {
// 사용자 정보 요청 처리 // 사용자 정보 요청 처리
export const getUserInfo = async (req, res) => { export const getUserInfo = async (req, res) => {
const {
cookies: { acs_token },
} = req;
try { try {
const decoded = jwt.decode(acs_token); const {
cookies: { acs_token },
} = req;
const decoded = jwt.verify(acs_token);
const result_user = await db.User.findAll({ const result_user = await db.User.findAll({
where: { email: decoded.email }, where: { email: decoded.email },
...@@ -261,7 +261,17 @@ export const getUserInfo = async (req, res) => { ...@@ -261,7 +261,17 @@ export const getUserInfo = async (req, res) => {
res.json({ msg: resForm.msg.ok, contents: { user_info: [user] } }); res.json({ msg: resForm.msg.ok, contents: { user_info: [user] } });
} catch (err) { } catch (err) {
console.log(err); console.log(err);
res.json({ msg: resForm.msg.err, contents: { error: err } });
// Return error message and default user.(독도)
res.json({
msg: resForm.msg.err,
contents: {
user_info: {
loc_code: 3743011,
},
error: err,
},
});
} }
}; };
......
...@@ -30,7 +30,7 @@ globalRouter.get(routes.logout, onlyPrivate, getLogout); ...@@ -30,7 +30,7 @@ globalRouter.get(routes.logout, onlyPrivate, getLogout);
globalRouter.get(routes.confirm, getConfirm); globalRouter.get(routes.confirm, getConfirm);
// User Info // User Info
globalRouter.get(routes.userinfo, onlyPrivate, getUserInfo); globalRouter.get(routes.userinfo, getUserInfo);
globalRouter.post(routes.editProfile, onlyPrivate, postEditProfile); globalRouter.post(routes.editProfile, onlyPrivate, postEditProfile);
globalRouter.get(routes.toggleAircon, onlyPrivate, getToggleAircon); globalRouter.get(routes.toggleAircon, onlyPrivate, getToggleAircon);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment