Transition to exported/imported based on peer type

This commit is contained in:
Michael Klein 2022-10-05 12:44:26 +02:00
parent 991bc5a6cd
commit 8b962b5c30
2 changed files with 18 additions and 6 deletions

View File

@ -0,0 +1,15 @@
import Controller from "@ember/controller";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
export default class DcPeersEditIndexController extends Controller {
@service router;
@action transitionToStartSubRouteByType(peerModel) {
if (peerModel.isDialer) {
this.router.replaceWith("dc.peers.edit.exported");
} else {
this.router.replaceWith("dc.peers.edit.imported");
}
}
}

View File

@ -1,6 +1,3 @@
<Route
@name={{routeName}}
as |route|>
{{did-insert (route-action 'replaceWith' 'dc.peers.edit.addresses')}}
</Route>
<Route @name={{routeName}} as |route|>
{{did-insert (fn this.transitionToStartSubRouteByType route.model.peer)}}
</Route>