Adapter With dependency from another Model

I’m trying to build an adapter for a third-party api that requires a token (set in my App.User model). The adapter itself however is registered to another model (App.Workauth).

Everything works fine when I navigate to the route. However when I go directly to the url, the required information for the current App.User is not yet loaded.

I’m trying to sort out how to make sure I have the username and token attributes from the App.User model before I try to load up the App.Workauth route…

Any help would be greatly appreciated!

Is this something you could do in the apps init function? ie:

App.initializer({
    name: 'bootstrap',
    initialize: function() {
        App.deferReadiness();
        App.User.find().then(function() {
            //do something with the users here... then start the app
            App.advanceReadiness();
        }, function(error) {
            window.alert("an error occurred loading the app");
        });
    }
});

I do something like this for my ember apps that require some global configuration is set before any route can be invoked

This could very likely be the trick to solving the situation… Although unfortunately this information isn’t available until I’ve authenticated the current user… so I’m not sure that I can use this exactly as it currently stands, if it can only be invoked on initial load…

I was thinking the router facelift may hold the key, but that still seems to be a trick… im new to promises as well so i have a few new things to learn here.