Skip to content

Commit

Permalink
chore: update get route
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgnreis committed Jan 15, 2024
1 parent ddbc96e commit f1de27f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions functions/routes/bling/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,21 @@ exports.get = ({ appSdk, admin }, req, res) => {
return appSdk.getAuth(storeId)
.then(async (auth) => {
try {
await updateAppData({ appSdk, storeId, auth }, {
code
})
getAppData({ appSdk, storeId, auth })
.then(appData => {
const { client_id, client_secret } = appData
console.log('Pass variables', JSON.stringify({client_id, client_secret, code, storeId}))
const bling = new Bling(client_id, client_secret, code, storeId)
bling.preparing
.then((e) => {
console.log('deu certo a criação de autenticação')
res.status(200).redirect('https://app.e-com.plus/#/apps/edit/102418/')
})
.catch(err => {
console.log(err)
res.status(200).redirect('https://app.e-com.plus/#/apps/edit/102418/')
})
})
res.status(200).redirect('https://app.e-com.plus/#/apps/edit/102418/')
} catch (error) {
console.error(error)
Expand Down

0 comments on commit f1de27f

Please sign in to comment.