0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 14:52:38 +00:00

Popup error when gDrive credentials are expired on both /edit and /new

This commit is contained in:
Trevor Buckner
2021-08-11 15:36:57 -04:00
parent a48c74b2e7
commit 0075b0836a
5 changed files with 188 additions and 16 deletions

View File

@@ -141,9 +141,12 @@ const newGoogleBrew = async (req, res, next)=>{
req.body = brew;
const newBrew = await GoogleActions.newGoogleBrew(oAuth2Client, brew);
return res.status(200).send(newBrew);
try {
const newBrew = await GoogleActions.newGoogleBrew(oAuth2Client, brew);
return res.status(200).send(newBrew);
} catch (err) {
return res.status(err.response.status).send(err);
}
};
const updateGoogleBrew = async (req, res, next)=>{
@@ -154,9 +157,12 @@ const updateGoogleBrew = async (req, res, next)=>{
const brew = req.body;
brew.text = mergeBrewText(brew.text, brew.style);
const updatedBrew = await GoogleActions.updateGoogleBrew(oAuth2Client, brew);
return res.status(200).send(updatedBrew);
try {
const updatedBrew = await GoogleActions.updateGoogleBrew(oAuth2Client, brew);
return res.status(200).send(updatedBrew);
} catch (err) {
return res.status(err.response.status).send(err);
}
};
router.post('/api', newBrew);