0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-01 13:02:43 +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

@@ -168,6 +168,7 @@ GoogleActions = {
.catch((err)=>{
console.log('Error saving to google');
console.error(err);
throw (err);
//return res.status(500).send('Error while saving');
});
}
@@ -203,8 +204,9 @@ GoogleActions = {
media : media
})
.catch((err)=>{
console.log('Error while creating new Google brew');
console.error(err);
return res.status(500).send('Error while creating google brew');
throw (err);
});
if(!obj) return;

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);