mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 04:23:58 +03:00
Add navigate method to Analytics provider (#5367)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
bb1abdc8cc
commit
d3fa4908ef
@ -13,6 +13,7 @@ export interface AnalyticProvider {
|
||||
setWorkspace: (ws: string) => void
|
||||
handleEvent: (event: string) => void
|
||||
handleError: (error: Error) => void
|
||||
navigate: (path: string) => void
|
||||
}
|
||||
|
||||
export const Analytics = {
|
||||
@ -51,6 +52,12 @@ export const Analytics = {
|
||||
providers.forEach((provider) => {
|
||||
provider.handleError(error)
|
||||
})
|
||||
},
|
||||
|
||||
navigate (path: string): void {
|
||||
providers.forEach((provider) => {
|
||||
provider.navigate(path)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { clone } from '@hcengineering/core'
|
||||
import { derived, get, writable } from 'svelte/store'
|
||||
import { closePopup } from './popups'
|
||||
@ -177,6 +178,7 @@ export function navigate (location: PlatformLocation, replace = false): boolean
|
||||
if (cur !== url) {
|
||||
const data = !embeddedPlatform ? null : { location }
|
||||
const _url = !embeddedPlatform ? url : undefined
|
||||
Analytics.navigate(url)
|
||||
if (replace) {
|
||||
history.replaceState(data, '', _url)
|
||||
} else {
|
||||
|
@ -250,7 +250,7 @@ export function start (
|
||||
lastNameFirst?: string
|
||||
},
|
||||
port: number,
|
||||
extraConfig?: Record<string, string>
|
||||
extraConfig?: Record<string, string | undefined>
|
||||
): () => void {
|
||||
const app = express()
|
||||
|
||||
|
@ -21,7 +21,7 @@ import { StorageConfiguration } from '@hcengineering/server-core'
|
||||
import serverToken from '@hcengineering/server-token'
|
||||
import { start } from '.'
|
||||
|
||||
export function startFront (ctx: MeasureContext, extraConfig?: Record<string, string>): void {
|
||||
export function startFront (ctx: MeasureContext, extraConfig?: Record<string, string | undefined>): void {
|
||||
const defaultLanguage = process.env.DEFAULT_LANGUAGE ?? 'en'
|
||||
const languages = process.env.LANGUAGES ?? 'en,ru'
|
||||
const SERVER_PORT = parseInt(process.env.SERVER_PORT ?? '8080')
|
||||
|
Loading…
Reference in New Issue
Block a user