Handle no license found
This commit is contained in:
parent
ee7fdcfaba
commit
4df48d306c
2 changed files with 8 additions and 1 deletions
2
packages/backend-core/src/cache/user.js
vendored
2
packages/backend-core/src/cache/user.js
vendored
|
@ -17,7 +17,9 @@ const populateFromDB = async (userId, tenantId) => {
|
||||||
// TODO: Break this out into it's own cache
|
// TODO: Break this out into it's own cache
|
||||||
if (account) {
|
if (account) {
|
||||||
const license = await accounts.getLicense(user.tenantId)
|
const license = await accounts.getLicense(user.tenantId)
|
||||||
|
if (license) {
|
||||||
user.license = license
|
user.license = license
|
||||||
|
}
|
||||||
user.account = account
|
user.account = account
|
||||||
user.accountPortalAccess = true
|
user.accountPortalAccess = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,11 @@ exports.getLicense = async tenantId => {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (response.status === 404) {
|
||||||
|
// no license for the tenant
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
const text = await response.text()
|
const text = await response.text()
|
||||||
console.error("Error getting license: ", text)
|
console.error("Error getting license: ", text)
|
||||||
|
|
Loading…
Reference in a new issue