mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-08 21:27:45 +03:00
TSK-811: Show last workspace location after switching/opening workspace (#2776)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
5d84053685
commit
602b23acd1
@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
if (application === undefined) {
|
||||
const last = localStorage.getItem('platform_last_loc')
|
||||
const last = localStorage.getItem(`platform_last_loc_${loc.path[1]}`)
|
||||
if (last !== null) {
|
||||
navigate(JSON.parse(last))
|
||||
} else {
|
||||
|
@ -115,6 +115,7 @@ export function navigate (location: PlatformLocation, store = true): void {
|
||||
if (store) {
|
||||
history.pushState(null, '', url)
|
||||
localStorage.setItem('platform_last_loc', JSON.stringify(location))
|
||||
localStorage.setItem(`platform_last_loc_${location.path[1]}`, JSON.stringify(location))
|
||||
}
|
||||
locationWritable.set(location)
|
||||
}
|
||||
|
@ -302,7 +302,12 @@ export function navigateToWorkspace (workspace: string, loginInfo?: WorkspaceLog
|
||||
// Json parse error could be ignored
|
||||
}
|
||||
}
|
||||
navigate({ path: [workbenchId, workspace] })
|
||||
const last = localStorage.getItem(`platform_last_loc_${workspace}`)
|
||||
if (last !== null) {
|
||||
navigate(JSON.parse(last))
|
||||
} else {
|
||||
navigate({ path: [workbenchId, workspace] })
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkJoined (inviteId: string): Promise<[Status, WorkspaceLoginInfo | undefined]> {
|
||||
|
@ -71,7 +71,10 @@
|
||||
closePopup()
|
||||
closePopup()
|
||||
if (ws !== getCurrentLocation().path[1]) {
|
||||
navigate({ path: [workbenchId, ws] })
|
||||
const last = localStorage.getItem(`platform_last_loc_${ws}`)
|
||||
if (last !== null) {
|
||||
navigate(JSON.parse(last))
|
||||
} else navigate({ path: [workbenchId, ws] })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,6 +260,13 @@
|
||||
let special = loc.path[4]
|
||||
const fragment = loc.fragment
|
||||
|
||||
if (app === undefined) {
|
||||
const last = localStorage.getItem(`platform_last_loc_${loc.path[1]}`)
|
||||
if (last != null) {
|
||||
navigate(JSON.parse(last))
|
||||
}
|
||||
}
|
||||
|
||||
if (currentAppAlias !== app) {
|
||||
clear(1)
|
||||
currentAppAlias = app
|
||||
|
Loading…
Reference in New Issue
Block a user