Skip to content

Commit

Permalink
Merge pull request #403 from TeamSparker/refactor/#402
Browse files Browse the repository at this point in the history
[REFACTOR] authDoorbellGET API refactoring
  • Loading branch information
youngkwon02 authored May 11, 2022
2 parents c180ef3 + b904938 commit 2285107
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions functions/api/routes/auth/authDoorbellGET.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ module.exports = async (req, res) => {

// 회원가입 한적 없는 사용자
if (!user) {
res.status(statusCode.OK).send(util.success(statusCode.OK, responseMessage.NOT_SIGNED_UP, { isNew: true }));
return res.status(statusCode.OK).send(util.success(statusCode.OK, responseMessage.NOT_SIGNED_UP, { isNew: true }));
}

let data = jwtHandlers.sign(user);
data.isNew = false;
res.status(statusCode.OK).send(util.success(statusCode.OK, responseMessage.ALREADY_SIGNED_UP, data));
await userDB.updateDeviceTokenById(client, user.userId, fcmToken);
return res.status(statusCode.OK).send(util.success(statusCode.OK, responseMessage.ALREADY_SIGNED_UP, data));
} catch (error) {
console.log(error);
functions.logger.error(`[ERROR] [${req.method.toUpperCase()}] ${req.originalUrl}`, `[CONTENT] ${error}`);
const slackMessage = `[ERROR] [${req.method.toUpperCase()}] ${req.originalUrl} ${error} ${JSON.stringify(error)}`;
slackAPI.sendMessageToSlack(slackMessage, slackAPI.DEV_WEB_HOOK_ERROR_MONITORING);

res.status(statusCode.INTERNAL_SERVER_ERROR).send(util.fail(statusCode.INTERNAL_SERVER_ERROR, responseMessage.INTERNAL_SERVER_ERROR));
return res.status(statusCode.INTERNAL_SERVER_ERROR).send(util.fail(statusCode.INTERNAL_SERVER_ERROR, responseMessage.INTERNAL_SERVER_ERROR));
} finally {
client.release();
}
Expand Down

0 comments on commit 2285107

Please sign in to comment.