change(tracker): change session url building

This commit is contained in:
sylenien 2022-08-30 12:52:01 +02:00
parent 7f3f013957
commit 7aa658b59a
2 changed files with 7 additions and 14 deletions

View file

@ -292,7 +292,13 @@ export default class App {
}
getSessionURL(): string {
return this.session.getSessionURL()
const { projectID, sessionID } = this.session.getInfo()
if (!projectID || !sessionID) {
this.debug.error('OpenReplay error: Unable to build session URL')
return ''
}
return this.options.ingestPoint.replace(/\/ingest$/, `${projectID}/session/${sessionID}`)
}
getHost(): string {
@ -430,11 +436,6 @@ export default class App {
this.session.setSessionToken(token)
this.localStorage.setItem(this.options.local_uuid_key, userUUID)
this.session.update({ sessionID, timestamp: startTimestamp || timestamp, projectID }) // TODO: no no-explicit 'any'
this.session.buildURL(
`${this.options.ingestPoint.replace(/\/ingest$/, '')}/${projectID as string}/session/${
sessionID as string
}`,
)
const startWorkerMsg: WorkerMessageData = {
type: 'auth',

View file

@ -126,14 +126,6 @@ export default class Session {
}
}
buildURL(url: string): void {
this.sessionUrl = url
}
getSessionURL(): string {
return this.sessionUrl
}
reset(): void {
this.app.sessionStorage.removeItem(this.options.session_token_key)
this.metadata = {}