TSK-811: Fix for undefined when saving platform last location (#2790)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-03-21 16:58:23 +05:00 committed by GitHub
parent 384aac3682
commit d65cb70652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,8 +115,10 @@ export function navigate (location: PlatformLocation, store = true): void {
if (store) {
history.pushState(null, '', url)
localStorage.setItem('platform_last_loc', JSON.stringify(location))
if (location.path[1] !== undefined) {
localStorage.setItem(`platform_last_loc_${location.path[1]}`, JSON.stringify(location))
}
}
locationWritable.set(location)
}
}