Fixing code post rebase
This commit is contained in:
parent
ec93891c6b
commit
45a2721c5c
@ -31,7 +31,7 @@ class ConnectionManager {
|
|||||||
|
|
||||||
const room = new Room(window.location.pathname);
|
const room = new Room(window.location.pathname);
|
||||||
return Promise.resolve(room);
|
return Promise.resolve(room);
|
||||||
} else if (connexionType === GameConnexionTypes.anonymous) {
|
} else if (connexionType === GameConnexionTypes.anonymous || connexionType === GameConnexionTypes.empty) {
|
||||||
const localUser = localUserStore.getLocalUser();
|
const localUser = localUserStore.getLocalUser();
|
||||||
|
|
||||||
if (localUser && localUser.jwtToken && localUser.uuid) {
|
if (localUser && localUser.jwtToken && localUser.uuid) {
|
||||||
@ -41,7 +41,14 @@ class ConnectionManager {
|
|||||||
this.localUser = new LocalUser(data.userUuid, data.authToken);
|
this.localUser = new LocalUser(data.userUuid, data.authToken);
|
||||||
localUserStore.saveUser(this.localUser);
|
localUserStore.saveUser(this.localUser);
|
||||||
}
|
}
|
||||||
const room = new Room(window.location.pathname);
|
let roomId: string
|
||||||
|
if (connexionType === GameConnexionTypes.empty) {
|
||||||
|
const defaultMapUrl = window.location.host.replace('play.', 'maps.') + URL_ROOM_STARTED;
|
||||||
|
roomId = urlManager.editUrlForRoom(defaultMapUrl, null, null);
|
||||||
|
} else {
|
||||||
|
roomId = window.location.pathname;
|
||||||
|
}
|
||||||
|
const room = new Room(roomId);
|
||||||
return Promise.resolve(room);
|
return Promise.resolve(room);
|
||||||
} else if (connexionType == GameConnexionTypes.organization) {
|
} else if (connexionType == GameConnexionTypes.organization) {
|
||||||
const localUser = localUserStore.getLocalUser();
|
const localUser = localUserStore.getLocalUser();
|
||||||
@ -55,11 +62,8 @@ class ConnectionManager {
|
|||||||
return Promise.reject('Could not find a user in localstorage');
|
return Promise.reject('Could not find a user in localstorage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo: cleaner way to handle the default case
|
return Promise.reject('Invalid URL');
|
||||||
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 {
|
||||||
|
@ -3,6 +3,7 @@ export enum GameConnexionTypes {
|
|||||||
anonymous=1,
|
anonymous=1,
|
||||||
organization,
|
organization,
|
||||||
register,
|
register,
|
||||||
|
empty,
|
||||||
unknown,
|
unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,9 +18,11 @@ class UrlManager {
|
|||||||
} else if (url.includes('@/')) {
|
} else if (url.includes('@/')) {
|
||||||
return GameConnexionTypes.organization;
|
return GameConnexionTypes.organization;
|
||||||
} else if(url.includes('register/')) {
|
} else if(url.includes('register/')) {
|
||||||
return GameConnexionTypes.register
|
return GameConnexionTypes.register;
|
||||||
|
} else if(url === '/') {
|
||||||
|
return GameConnexionTypes.empty;
|
||||||
} else {
|
} else {
|
||||||
return GameConnexionTypes.unknown
|
return GameConnexionTypes.unknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user