2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|