Skip to content

Commit

Permalink
fix(distribution): redirect to first inquiry after fetching navigatio…
Browse files Browse the repository at this point in the history
…n data
  • Loading branch information
luytena committed Jan 13, 2025
1 parent 5508ba4 commit ff9d305
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/distribution/addon/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import Route from "@ember/routing/route";
import { scheduleOnce } from "@ember/runloop";
import { inject as service } from "@ember/service";

export default class IndexRoute extends Route {
@service("-scheduler") scheduler;
@service distribution;
@service router;

async redirect() {
// trigger resource
this.distribution.navigation.value;

async redirectToFirstInquiry() {
// wait for navigation request and group resolver
await this.distribution.fetchNavigation.last;
await this.scheduler.resolveGroup.last;
Expand All @@ -25,4 +23,8 @@ export default class IndexRoute extends Route {
});
}
}

afterModel() {
scheduleOnce("afterRender", this, "redirectToFirstInquiry");
}
}

0 comments on commit ff9d305

Please sign in to comment.