import { A } from '@ember/array';
import Route from '@ember/routing/route';
import RSVP from 'rsvp';

import AuthenticatedRoute from '../mixins/authenticated-route';

export default Route.extend(AuthenticatedRoute, {
  setupController(controller) {
    this._super(...arguments);

    controller.set('myCrates', this.get('data.myCrates'));
    controller.set('myFollowing', this.get('data.myFollowing'));
    controller.set('myStats', this.get('data.myStats'));

    if (!controller.loadingMore) {
      controller.set('myFeed', A());
      controller.send('loadMore');
    }
  },

  model() {
    return this.get('session.currentUser');
  },

  async afterModel(user) {
    let myCrates = this.store.query('crate', {
      user_id: user.get('id'),
    });

    let myFollowing = this.store.query('crate', {
      following: 1,
    });

    let myStats = user.stats();

    this.set('data', await RSVP.hash({ myCrates, myFollowing, myStats }));
  },
});

@@ -238,16 +238,23 @@
 ntroller
+, model
 ) %7B%0A    
@@ -312,30 +312,21 @@
 rates', 
-this.get('data
+model
 .myCrate
@@ -326,18 +326,16 @@
 myCrates
-')
 );%0A    c
@@ -363,30 +363,21 @@
 owing', 
-this.get('data
+model
 .myFollo
@@ -380,18 +380,16 @@
 ollowing
-')
 );%0A    c
@@ -417,30 +417,21 @@
 s', 
-this.get('data
+model
 .myStats
 '));
@@ -426,18 +426,16 @@
 .myStats
-')
 );%0A%0A    
@@ -551,16 +551,22 @@
   %7D,%0A%0A  
+async 
 model() 
@@ -575,25 +575,24 @@
     
-return
+let user =
  this.
-get('
 sess
@@ -610,44 +610,10 @@
 User
-');%0A  %7D,%0A%0A  async afterModel(user) %7B
+;%0A
 %0A   
@@ -655,22 +655,16 @@
 rate', %7B
-%0A     
  user_id
@@ -679,27 +679,21 @@
 et('id')
-,%0A   
  %7D);%0A
-%0A
     let 
@@ -733,22 +733,16 @@
 rate', %7B
-%0A     
  followi
@@ -750,19 +750,13 @@
 g: 1
-,%0A   
  %7D);%0A
-%0A
     
@@ -792,24 +792,14 @@
     
-this.set('data',
+return
  awa
@@ -846,17 +846,16 @@
 Stats %7D)
-)
 ;%0A  %7D,%0A%7D

Merge `model()` and `afterModel()` hook