Files
threshold-ui/ui/desktop/app/initializers/cluster-url.js
T
Zhihe Li bcf004b8a4 Reformat codebase with trailing commas in functions (#2006)
* style: 💄 Update trailing commas in API

* style: 💄 Update trailing commas in core

* style: 💄 Update trailing commas in rose

* style: 💄 Update trailing commas in admin

* style: 💄 Update trailing commas in desktop
2023-11-22 14:07:41 -05:00

35 lines
941 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { getOwner } from '@ember/application';
export function initialize(registry) {
// Lookup the application route
const ApplicationRoute = registry.resolveRegistration
? registry.resolveRegistration('route:application')
: registry.resolve('route:application');
ApplicationRoute.reopen({
init() {
this._super(...arguments);
const originalBeforeModel = this.beforeModel;
// Override the beforeModel hook and initialize the clusterUrl
this.beforeModel = async function () {
const clusterUrl = getOwner(this).lookup('service:clusterUrl');
return clusterUrl.updateClusterUrl().then(
() => originalBeforeModel.apply(this, arguments),
() => originalBeforeModel.apply(this, arguments),
);
};
},
});
}
export default {
after: 'ember-simple-auth',
initialize,
};