Skip to content

Commit 04d6ac4

Browse files
committed
app: refactor AppView.goTo to use PUBLIC_URL
1 parent df8f2bc commit 04d6ac4

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

app/src/store/views/appView.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,28 @@ export default class AppView {
3434

3535
/** navigate to the specified route */
3636
goTo(route: string) {
37-
if (this._store.router.location.pathname !== route) {
38-
this._store.router.push(route);
37+
const path = `${PUBLIC_URL}${route}`;
38+
if (this._store.router.location.pathname !== path) {
39+
this._store.router.push(path);
3940
}
4041
}
4142

4243
/** Change to the Auth page */
4344
gotoAuth() {
44-
this.goTo(`${PUBLIC_URL}/`);
45+
this.goTo(`/`);
4546
this._store.log.info('Go to the Auth page');
4647
}
4748

4849
/** Change to the Home page */
4950
goToHome() {
50-
this.goTo(`${PUBLIC_URL}/home`);
51+
this.goTo(`/home`);
5152
this._store.settingsStore.autoCollapseSidebar();
5253
this._store.log.info('Go to the Home page');
5354
}
5455

5556
/** Change to the Loop page */
5657
goToLoop() {
57-
this.goTo(`${PUBLIC_URL}/loop`);
58+
this.goTo(`/loop`);
5859
this._store.settingsStore.autoCollapseSidebar();
5960
if (!this._store.settingsStore.tourAutoShown) {
6061
this.showTour();
@@ -65,36 +66,36 @@ export default class AppView {
6566

6667
/** Change to the History page */
6768
goToHistory() {
68-
this.goTo(`${PUBLIC_URL}/history`);
69+
this.goTo(`/history`);
6970
this._store.settingsStore.autoCollapseSidebar();
7071
this._store.log.info('Go to the History page');
7172
}
7273

7374
/** Change to the Pool page */
7475
goToPool() {
75-
this.goTo(`${PUBLIC_URL}/pool`);
76+
this.goTo(`/pool`);
7677
// always collapse the sidebar to make room for the Pool sidebar
7778
this._store.settingsStore.sidebarVisible = false;
7879
this._store.log.info('Go to the Pool page');
7980
}
8081

8182
/** Change to the Settings page */
8283
goToSettings() {
83-
this.goTo(`${PUBLIC_URL}/settings`);
84+
this.goTo(`/settings`);
8485
this._store.settingsStore.autoCollapseSidebar();
8586
this._store.log.info('Go to the Settings page');
8687
}
8788

8889
/** Change to the Connect page */
8990
goToConnect() {
90-
this.goTo(`${PUBLIC_URL}/connect`);
91+
this.goTo(`/connect`);
9192
this._store.settingsStore.autoCollapseSidebar();
9293
this._store.log.info('Go to the Connect page');
9394
}
9495

9596
/** Change to the Connect Custom page */
9697
goToConnectCustom() {
97-
this.goTo(`${PUBLIC_URL}/connect/custom`);
98+
this.goTo(`/connect/custom`);
9899
this._store.settingsStore.autoCollapseSidebar();
99100
this._store.log.info('Go to the Connect Custom page');
100101
}
@@ -185,7 +186,7 @@ export default class AppView {
185186
/** sets the selected setting to display */
186187
showSettings(name: SettingName) {
187188
const path = name === '' ? '' : `/${name}`;
188-
this.goTo(`${PUBLIC_URL}/settings${path}`);
189+
this.goTo(`/settings${path}`);
189190
this._store.log.info('Switch to Setting screen', name);
190191
}
191192

0 commit comments

Comments
 (0)