Wait until config is loaded before using values
This commit is contained in:
parent
b45a98eb57
commit
da1424f97e
1 changed files with 9 additions and 5 deletions
|
|
@ -129,12 +129,16 @@ router.beforeEach((to, from, next) => {
|
|||
let roomId = util.sanitizeUserId(to.params.userId);
|
||||
if (roomId && !roomId.startsWith("@")) {
|
||||
// Not a full username. Assume local name on this server.
|
||||
const user = new User(router.app.$config.defaultServer, roomId, "");
|
||||
user.normalize();
|
||||
roomId = "@" + roomId + ":" + User.serverDomain(user.home_server);
|
||||
return router.app.$config.promise.then((config) => {
|
||||
const user = new User(config.defaultServer, roomId, "");
|
||||
user.normalize();
|
||||
roomId = "@" + roomId + ":" + User.serverDomain(user.home_server);
|
||||
router.app.$matrix.setCurrentRoomId(roomId);
|
||||
}).catch(err => console.error(err)).finally(() => next());
|
||||
} else {
|
||||
router.app.$matrix.setCurrentRoomId(roomId);
|
||||
authRequired = false;
|
||||
}
|
||||
router.app.$matrix.setCurrentRoomId(roomId);
|
||||
authRequired = false;
|
||||
}
|
||||
} else if (to.name == 'Invite') {
|
||||
if (to.params.roomId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue