Merge pull request #89 from emrysal/bugfix/after-add-google-integration-missing
Fixes adding google integration not appearing in the dashboard
This commit is contained in:
commit
a52d95240c
1 changed files with 5 additions and 6 deletions
|
@ -27,7 +27,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
|
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
|
||||||
|
|
||||||
// Convert to token
|
// Convert to token
|
||||||
oAuth2Client.getToken(code, async (err, token) => {
|
return new Promise( (resolve, reject) => oAuth2Client.getToken(code, async (err, token) => {
|
||||||
if (err) return console.error('Error retrieving access token', err);
|
if (err) return console.error('Error retrieving access token', err);
|
||||||
|
|
||||||
const credential = await prisma.credential.create({
|
const credential = await prisma.credential.create({
|
||||||
|
@ -37,9 +37,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
userId: user.id
|
userId: user.id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Add the credential
|
|
||||||
|
|
||||||
res.redirect('/integrations');
|
res.redirect('/integrations');
|
||||||
|
resolve();
|
||||||
|
}));
|
||||||
}
|
}
|
Loading…
Reference in a new issue