2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
2020-07-09 09:08:47 +00:00
|
|
|
import Helper from '@ember/component/helper';
|
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { getOwner } from '@ember/application';
|
|
|
|
|
2020-12-08 09:27:28 +00:00
|
|
|
export default class RefreshRouteHelper extends Helper {
|
|
|
|
@service('router') router;
|
|
|
|
|
2020-07-09 09:08:47 +00:00
|
|
|
compute(params, hash) {
|
|
|
|
return () => {
|
|
|
|
const container = getOwner(this);
|
|
|
|
const routeName = this.router.currentRoute.name;
|
|
|
|
return container.lookup(`route:${routeName}`).refresh();
|
|
|
|
};
|
2020-12-08 09:27:28 +00:00
|
|
|
}
|
|
|
|
}
|