Making logic around logout very explicit.
This commit is contained in:
parent
70d91acc41
commit
b6be98fa4e
|
@ -42,12 +42,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if real tenant
|
// check if real tenant
|
||||||
const info = await tenants.info(urlTenantId)
|
const { exists: tenantExists } = await tenants.info(urlTenantId)
|
||||||
if (!info.exists) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (urlTenantId && user.tenantId !== urlTenantId) {
|
if (tenantExists && user.tenantId !== urlTenantId) {
|
||||||
// user should not be here - play it safe and log them out
|
// user should not be here - play it safe and log them out
|
||||||
try {
|
try {
|
||||||
await auth.logout()
|
await auth.logout()
|
||||||
|
|
|
@ -6,6 +6,9 @@ export function tenantsStore() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
info: async tenantId => {
|
info: async tenantId => {
|
||||||
|
if (!tenantId) {
|
||||||
|
return { exists: false }
|
||||||
|
}
|
||||||
const contents = get(store)
|
const contents = get(store)
|
||||||
const found = contents.tenantInfo[tenantId]
|
const found = contents.tenantInfo[tenantId]
|
||||||
if (found) {
|
if (found) {
|
||||||
|
|
Loading…
Reference in New Issue