Simplifying code and making START_ROOM_URL compatible with public (_) and private (@) paths
This commit is contained in:
parent
d79a18ee81
commit
bbf9325396
4 changed files with 7 additions and 25 deletions
|
@ -32,26 +32,12 @@ class UrlManager {
|
|||
return match ? match [1] : null;
|
||||
}
|
||||
|
||||
|
||||
//todo: simply use the roomId
|
||||
//todo: test this with cypress
|
||||
public editUrlForRoom(roomSlug: string, organizationSlug: string|null, worldSlug: string |null): string {
|
||||
let newUrl:string;
|
||||
if (organizationSlug) {
|
||||
newUrl = '/@/'+organizationSlug+'/'+worldSlug+'/'+roomSlug;
|
||||
} else {
|
||||
newUrl = '/@/'+roomSlug;
|
||||
}
|
||||
history.pushState({}, 'WorkAdventure', newUrl);
|
||||
return newUrl;
|
||||
}
|
||||
|
||||
public pushRoomIdToUrl(room:Room): void {
|
||||
if (window.location.pathname === room.id) return;
|
||||
if (window.location.pathname === room.id) return;
|
||||
const hash = window.location.hash;
|
||||
history.pushState({}, 'WorkAdventure', room.id+hash);
|
||||
}
|
||||
|
||||
|
||||
public getStartLayerNameFromUrl(): string|null {
|
||||
const hash = window.location.hash;
|
||||
return hash.length > 1 ? hash.substring(1) : null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue