mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +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 {
|
export function setLoginInfo (loginInfo: WorkspaceLoginInfo): void {
|
||||||
setMetadata(login.metadata.LoginToken, loginInfo.token)
|
|
||||||
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
||||||
tokens[loginInfo.workspace] = loginInfo.token
|
tokens[loginInfo.workspace] = loginInfo.token
|
||||||
|
|
||||||
@ -290,6 +289,7 @@ export function navigateToWorkspace (workspace: string, loginInfo?: WorkspaceLog
|
|||||||
if (loginInfo == null) {
|
if (loginInfo == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
setMetadata(login.metadata.LoginToken, loginInfo.token)
|
||||||
setLoginInfo(loginInfo)
|
setLoginInfo(loginInfo)
|
||||||
|
|
||||||
if (navigateUrl !== undefined) {
|
if (navigateUrl !== undefined) {
|
||||||
|
@ -14,33 +14,16 @@
|
|||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import login from '@hcengineering/login'
|
import login from '@hcengineering/login'
|
||||||
import {
|
import { navigateToWorkspace, selectWorkspace, setLoginInfo, Workspace } from '@hcengineering/login-resources'
|
||||||
getWorkspaces,
|
|
||||||
selectWorkspace,
|
|
||||||
Workspace,
|
|
||||||
navigateToWorkspace,
|
|
||||||
setLoginInfo
|
|
||||||
} from '@hcengineering/login-resources'
|
|
||||||
import { getEmbeddedLabel } from '@hcengineering/platform'
|
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 { workbenchId } from '@hcengineering/workbench'
|
||||||
import { onMount } from 'svelte'
|
|
||||||
import workbench from '../plugin'
|
import workbench from '../plugin'
|
||||||
|
|
||||||
export let workspaces: Workspace[]
|
export let workspaces: Workspace[]
|
||||||
|
|
||||||
let _workspaces: Workspace[] = []
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
if (workspaces.length === 0) {
|
|
||||||
getWorkspaces().then((ws: Workspace[]) => (_workspaces = ws))
|
|
||||||
} else {
|
|
||||||
_workspaces = workspaces
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
$: actions = [
|
$: actions = [
|
||||||
..._workspaces.map((w) => ({
|
...workspaces.map((w) => ({
|
||||||
label: getEmbeddedLabel(w.workspace),
|
label: getEmbeddedLabel(w.workspace),
|
||||||
action: async () => {
|
action: async () => {
|
||||||
const loginInfo = (await selectWorkspace(w.workspace))[1]
|
const loginInfo = (await selectWorkspace(w.workspace))[1]
|
||||||
@ -76,4 +59,8 @@
|
|||||||
]
|
]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Menu {actions} on:close />
|
{#if workspaces.length}
|
||||||
|
<Menu {actions} on:close />
|
||||||
|
{:else}
|
||||||
|
<Loading />
|
||||||
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user