mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
Fix changed token (#2439)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
94cbd80336
commit
a9d839245d
@ -277,7 +277,6 @@ export async function selectWorkspace (workspace: string): Promise<[Status, Work
|
||||
}
|
||||
|
||||
export function setLoginInfo (loginInfo: WorkspaceLoginInfo): void {
|
||||
setMetadata(login.metadata.LoginToken, loginInfo.token)
|
||||
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
||||
tokens[loginInfo.workspace] = loginInfo.token
|
||||
|
||||
@ -290,6 +289,7 @@ export function navigateToWorkspace (workspace: string, loginInfo?: WorkspaceLog
|
||||
if (loginInfo == null) {
|
||||
return
|
||||
}
|
||||
setMetadata(login.metadata.LoginToken, loginInfo.token)
|
||||
setLoginInfo(loginInfo)
|
||||
|
||||
if (navigateUrl !== undefined) {
|
||||
|
@ -14,33 +14,16 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import login from '@hcengineering/login'
|
||||
import {
|
||||
getWorkspaces,
|
||||
selectWorkspace,
|
||||
Workspace,
|
||||
navigateToWorkspace,
|
||||
setLoginInfo
|
||||
} from '@hcengineering/login-resources'
|
||||
import { navigateToWorkspace, selectWorkspace, setLoginInfo, Workspace } from '@hcengineering/login-resources'
|
||||
import { getEmbeddedLabel } from '@hcengineering/platform'
|
||||
import { navigate, Menu, locationToUrl } from '@hcengineering/ui'
|
||||
import { Loading, locationToUrl, Menu, navigate } from '@hcengineering/ui'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import { onMount } from 'svelte'
|
||||
import workbench from '../plugin'
|
||||
|
||||
export let workspaces: Workspace[]
|
||||
|
||||
let _workspaces: Workspace[] = []
|
||||
|
||||
onMount(() => {
|
||||
if (workspaces.length === 0) {
|
||||
getWorkspaces().then((ws: Workspace[]) => (_workspaces = ws))
|
||||
} else {
|
||||
_workspaces = workspaces
|
||||
}
|
||||
})
|
||||
|
||||
$: actions = [
|
||||
..._workspaces.map((w) => ({
|
||||
...workspaces.map((w) => ({
|
||||
label: getEmbeddedLabel(w.workspace),
|
||||
action: async () => {
|
||||
const loginInfo = (await selectWorkspace(w.workspace))[1]
|
||||
@ -76,4 +59,8 @@
|
||||
]
|
||||
</script>
|
||||
|
||||
<Menu {actions} on:close />
|
||||
{#if workspaces.length}
|
||||
<Menu {actions} on:close />
|
||||
{:else}
|
||||
<Loading />
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user