2
0

: 🔒️ Investigate on why spreadsheets sometimes fail

This commit is contained in:
Baptiste Arnaud
2022-04-20 10:05:33 -07:00
parent b1759749e4
commit bdd7a1712e
6 changed files with 29 additions and 13 deletions

View File

@ -21,12 +21,12 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const spreadsheetId = req.query.id.toString()
const doc = new GoogleSpreadsheet(spreadsheetId)
const client = await getAuthenticatedGoogleClient(user.id, credentialsId)
if (!client)
const auth = await getAuthenticatedGoogleClient(user.id, credentialsId)
if (!auth)
return res
.status(404)
.send({ message: "Couldn't find credentials in database" })
doc.useOAuth2Client(client)
doc.useOAuth2Client(auth.client)
await doc.loadInfo()
return res.send({
sheets: (