mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 04:49:00 +00:00
UBERF-4807 (#4307)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
acd80be4df
commit
b0bc0bc566
@ -14,6 +14,7 @@ import presentation, { closeClient, refreshClient, setClient } from '@hcengineer
|
|||||||
import {
|
import {
|
||||||
fetchMetadataLocalStorage,
|
fetchMetadataLocalStorage,
|
||||||
getCurrentLocation,
|
getCurrentLocation,
|
||||||
|
locationStorageKeyId,
|
||||||
navigate,
|
navigate,
|
||||||
networkStatus,
|
networkStatus,
|
||||||
setMetadataLocalStorage
|
setMetadataLocalStorage
|
||||||
@ -33,7 +34,21 @@ addEventListener(client.event.NetworkRequests, async (event: string, val: number
|
|||||||
export async function connect (title: string): Promise<Client | undefined> {
|
export async function connect (title: string): Promise<Client | undefined> {
|
||||||
const loc = getCurrentLocation()
|
const loc = getCurrentLocation()
|
||||||
const ws = loc.path[1]
|
const ws = loc.path[1]
|
||||||
if (ws === undefined) return
|
if (ws === undefined) {
|
||||||
|
const lastLoc = localStorage.getItem(locationStorageKeyId)
|
||||||
|
if (lastLoc !== null) {
|
||||||
|
const lastLocObj = JSON.parse(lastLoc)
|
||||||
|
if (lastLocObj.path !== undefined && lastLocObj.path[0] === loc.path[0]) {
|
||||||
|
navigate(lastLocObj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
navigate({
|
||||||
|
path: [loginId]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
||||||
const token = tokens[ws]
|
const token = tokens[ws]
|
||||||
setMetadata(presentation.metadata.Token, token)
|
setMetadata(presentation.metadata.Token, token)
|
||||||
|
Loading…
Reference in New Issue
Block a user