0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-01 23:52:40 +00:00

update googleActions and related files to use service-level auth where viable

This commit is contained in:
Charlie Humphreys
2022-02-14 22:21:58 -06:00
parent 42afbd3e70
commit 59d08a7414
3 changed files with 32 additions and 45 deletions

View File

@@ -167,15 +167,11 @@ const newGoogleBrew = async (req, res, next)=>{
};
const updateGoogleBrew = async (req, res, next)=>{
let oAuth2Client;
try { oAuth2Client = GoogleActions.authCheck(req.account, res); } catch (err) { return res.status(err.status).send(err.message); }
const brew = excludePropsFromUpdate(req.body);
brew.text = mergeBrewText(brew);
try {
const updatedBrew = await GoogleActions.updateGoogleBrew(oAuth2Client, brew);
const updatedBrew = await GoogleActions.updateGoogleBrew(brew);
return res.status(200).send(updatedBrew);
} catch (err) {
return res.status(err.response?.status || 500).send(err);