Files
threshold-ui/ui/desktop/app/routes/index.js
T
2025-03-12 08:29:54 -07:00

29 lines
607 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Route from '@ember/routing/route';
import { service } from '@ember/service';
export default class IndexRoute extends Route {
// =services
@service clusterUrl;
@service router;
// =methods
/**
* If no clusterUrl is specified yet, redirects to cluster-url, otherwise scopes.
*/
redirect() {
const rendererClusterUrl = this.clusterUrl.rendererClusterUrl;
if (!rendererClusterUrl) {
this.router.replaceWith('cluster-url');
} else {
this.router.replaceWith('scopes');
}
}
}