added an edge case for the default map url
This commit is contained in:
parent
d98efc0433
commit
ccf80c1dd0
2 changed files with 9 additions and 1 deletions
|
@ -7,6 +7,8 @@ import {localUserStore} from "./LocalUserStore";
|
||||||
import {LocalUser} from "./LocalUser";
|
import {LocalUser} from "./LocalUser";
|
||||||
import {Room} from "./Room";
|
import {Room} from "./Room";
|
||||||
|
|
||||||
|
const URL_ROOM_STARTED = '/Floor0/floor0.json';
|
||||||
|
|
||||||
class ConnectionManager {
|
class ConnectionManager {
|
||||||
private localUser!:LocalUser;
|
private localUser!:LocalUser;
|
||||||
|
|
||||||
|
@ -53,7 +55,11 @@ class ConnectionManager {
|
||||||
return Promise.reject('Could not find a user in localstorage');
|
return Promise.reject('Could not find a user in localstorage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Promise.reject('ConnexionManager initialization failed: invalid URL');
|
|
||||||
|
//todo: cleaner way to handle the default case
|
||||||
|
const defaultMapUrl = window.location.host.replace('api.', 'maps.') + URL_ROOM_STARTED;
|
||||||
|
const defaultRoomId = urlManager.editUrlForRoom(URL_ROOM_STARTED, null, null);
|
||||||
|
return Promise.resolve(new Room(defaultRoomId, defaultMapUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public initBenchmark(): void {
|
public initBenchmark(): void {
|
||||||
|
|
|
@ -36,6 +36,8 @@ class UrlManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//todo: simply use the roomId
|
||||||
|
//todo: test this with cypress
|
||||||
public editUrlForRoom(roomSlug: string, organizationSlug: string|null, worldSlug: string |null): string {
|
public editUrlForRoom(roomSlug: string, organizationSlug: string|null, worldSlug: string |null): string {
|
||||||
let newUrl:string;
|
let newUrl:string;
|
||||||
if (organizationSlug) {
|
if (organizationSlug) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue