Skip to content

Commit

Permalink
feat: check CLOUDCOMMERCE_PROJECT_ID and dinamically set discounts …
Browse files Browse the repository at this point in the history
…app auth uri

gambi 🔧

ecomplus/cloud-commerce#41
  • Loading branch information
leomp12 committed Aug 17, 2022
1 parent 1ce06c8 commit 54db8bf
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/components/js/EcApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,25 @@ export default {
requestInstall () {
this.isSwitching = true
this.hasInstallPopover = false
this.ecomApps.install(this.appId, true)
const storeApp = this.applicationBody.store_app
let authCallbackUri
if (storeApp) {
authCallbackUri = storeApp.auth_callback_uri
const cloudcommercePid = window.CLOUDCOMMERCE_PROJECT_ID
if (cloudcommercePid) {
switch (this.appId) {
case 1252:
authCallbackUri = `https://us-east1-${cloudcommercePid}.cloudfunctions.net/appAuthCallback`
}
}
}
this.ecomApps.install(this.appId, true, {
...this.applicationBody,
store_app: {
...storeApp,
auth_callback_uri: authCallbackUri
}
})
.then(installed => {
this.successToast(this.i19successfullyInstalled)
this.fetchStoreApplication(installed.result._id)
Expand Down

0 comments on commit 54db8bf

Please # to comment.