Skip to content

Commit c8f0859

Browse files
cyrilchandelierflovilmart
authored andcommitted
Redirect to the first app browser when only a single app is registered (#958)
* Redirect to the first app browser when only a single app is registered * Apply @flovilmart suggestion to use the deconstructing operator when extracting a single app for redirecting
1 parent 633c7a1 commit c8f0859

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/dashboard/Apps/AppsIndex.react.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ export default class AppsIndex extends React.Component {
9696
}
9797

9898
componentWillMount() {
99+
if (AppsManager.apps().length === 1) {
100+
const [app] = AppsManager.apps();
101+
history.push(`/apps/${app.slug}/browser`);
102+
return;
103+
}
99104
document.body.addEventListener('keydown', this.focusField);
100105
AppsManager.getAllAppsIndexStats().then(() => {
101106
this.forceUpdate();

0 commit comments

Comments
 (0)