prevent redirect to acct portal when not necessary
This commit is contained in:
parent
50b547e0a9
commit
4933d6e67d
|
@ -30,7 +30,11 @@
|
||||||
if (user && user.tenantId) {
|
if (user && user.tenantId) {
|
||||||
// no tenant in the url - send to account portal to fix this
|
// no tenant in the url - send to account portal to fix this
|
||||||
if (!urlTenantId) {
|
if (!urlTenantId) {
|
||||||
window.location.href = $admin.accountPortalUrl
|
let redirectUrl = $admin.accountPortalUrl
|
||||||
|
if (!window.location.host.includes("localhost")) {
|
||||||
|
const redirectUrl = redirectUrl.replace("://", `://${user.tenantId}.`)
|
||||||
|
}
|
||||||
|
window.location.href = redirectUrl
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,16 +81,29 @@ export function createAuthStore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setInitInfo(info) {
|
async function setInitInfo(info) {
|
||||||
await api.post(`/api/global/auth/init`, info)
|
const response = await api.post(`/api/global/auth/init`, info)
|
||||||
|
const json = await response.json()
|
||||||
|
auth.update(store => {
|
||||||
|
store.initInfo = json
|
||||||
|
return store
|
||||||
|
})
|
||||||
|
return json
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getInitInfo() {
|
||||||
|
const response = await api.get(`/api/global/auth/init`)
|
||||||
|
const json = response.json()
|
||||||
|
auth.update(store => {
|
||||||
|
store.initInfo = json
|
||||||
|
return store
|
||||||
|
})
|
||||||
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
subscribe: store.subscribe,
|
subscribe: store.subscribe,
|
||||||
setOrganisation: setOrganisation,
|
setOrganisation: setOrganisation,
|
||||||
getInitInfo: async () => {
|
getInitInfo,
|
||||||
const response = await api.get(`/api/global/auth/init`)
|
|
||||||
return await response.json()
|
|
||||||
},
|
|
||||||
setInitInfo,
|
setInitInfo,
|
||||||
checkQueryString: async () => {
|
checkQueryString: async () => {
|
||||||
const urlParams = new URLSearchParams(window.location.search)
|
const urlParams = new URLSearchParams(window.location.search)
|
||||||
|
|
Loading…
Reference in New Issue