From 7f922afe790bcacb9e95fed3b532deb51eeb901b Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 3 Jun 2021 23:18:45 +0530 Subject: [PATCH] Reduce duplication in code Signed-off-by: RMidhunSuresh --- src/domain/session/leftpanel/LeftPanelViewModel.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/domain/session/leftpanel/LeftPanelViewModel.js b/src/domain/session/leftpanel/LeftPanelViewModel.js index eee53512..c1696d26 100644 --- a/src/domain/session/leftpanel/LeftPanelViewModel.js +++ b/src/domain/session/leftpanel/LeftPanelViewModel.js @@ -93,20 +93,17 @@ export class LeftPanelViewModel extends ViewModel { } toggleGrid() { + const room = this.navigation.path.get("room"); const details = this.navigation.path.get("details"); + let path = this.navigation.path.until("session"); if (this.gridEnabled) { - let path = this.navigation.path.until("session"); - const room = this.navigation.path.get("room"); if (room) { path = path.with(room); if (details) { path = path.with(details); } } - this.navigation.applyPath(path); } else { - let path = this.navigation.path.until("session"); - const room = this.navigation.path.get("room"); if (room) { path = path.with(this.navigation.segment("rooms", [room.value])); path = path.with(room); @@ -117,8 +114,8 @@ export class LeftPanelViewModel extends ViewModel { path = path.with(this.navigation.segment("rooms", [])); path = path.with(this.navigation.segment("empty-grid-tile", 0)); } - this.navigation.applyPath(path); } + this.navigation.applyPath(path); } get tileViewModels() {