mirror of
https://bitbucket.org/tagfer_team/tagfer-server.git
synced 2025-12-25 03:37:38 +00:00
T-954157790456099: Remove unnesseceary else statements
This commit is contained in:
parent
b49d62c151
commit
f7d84ceea5
@ -18,18 +18,17 @@ async function updateUserProfile(req, res) {
|
||||
|
||||
if (!utils.isProfileNumberValid(profileNumber, res)) {
|
||||
return;
|
||||
} else {
|
||||
const sessionId = utils.getSessionIdFromAuthHeader(req, res);
|
||||
try {
|
||||
const tagferId = authDao.getSession(sessionId).tagferId;
|
||||
profileDao.updateProfile(profileObj, profileNumber, tagferId).then( () => {
|
||||
res.status(http.CREATED).json({})
|
||||
}).catch( (error) => {
|
||||
res.status(http.INTERNAL_SERVER_ERROR).json({error: errors.APP_FIREBASE_DATABASE_ERROR})
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(http.UNAUTHORIZED).json({error})
|
||||
}
|
||||
}
|
||||
const sessionId = utils.getSessionIdFromAuthHeader(req, res);
|
||||
try {
|
||||
const tagferId = authDao.getSession(sessionId).tagferId;
|
||||
profileDao.updateProfile(profileObj, profileNumber, tagferId).then( () => {
|
||||
res.status(http.CREATED).json({})
|
||||
}).catch( (error) => {
|
||||
res.status(http.INTERNAL_SERVER_ERROR).json({error: errors.APP_FIREBASE_DATABASE_ERROR})
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(http.UNAUTHORIZED).json({error})
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,18 +36,17 @@ async function getUserProfile(req, res) {
|
||||
const profileNumber = req.params.profileNumber;
|
||||
if (!utils.isProfileNumberValid(profileNumber)) {
|
||||
return;
|
||||
} else {
|
||||
const sessionId = utils.getSessionIdFromAuthHeader(req, res);
|
||||
try {
|
||||
const tagferId = authDao.getSession(sessionId).tagferId;
|
||||
profileDao.getProfile(profileNumber,tagferId).then((profile) => {
|
||||
res.status(http.OK).json({profile})
|
||||
}).catch(error => {
|
||||
res.status(http.INTERNAL_SERVER_ERROR).json({error: error.code})
|
||||
})
|
||||
} catch (error) {
|
||||
res.status(http.UNAUTHORIZED).json({ error })
|
||||
}
|
||||
}
|
||||
const sessionId = utils.getSessionIdFromAuthHeader(req, res);
|
||||
try {
|
||||
const tagferId = authDao.getSession(sessionId).tagferId;
|
||||
profileDao.getProfile(profileNumber,tagferId).then((profile) => {
|
||||
res.status(http.OK).json({profile})
|
||||
}).catch(error => {
|
||||
res.status(http.INTERNAL_SERVER_ERROR).json({error: error.code})
|
||||
})
|
||||
} catch (error) {
|
||||
res.status(http.UNAUTHORIZED).json({ error })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user