* Use extra route for disconnected/initial state * Style connect screen properly * Hide widget when connected in favor of custom UI * Show account info in sidebar header
		
			
				
	
	
		
			34 lines
		
	
	
		
			710 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			710 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import Route from '@ember/routing/route';
 | 
						|
import { inject as service } from '@ember/service';
 | 
						|
import { later } from '@ember/runloop';
 | 
						|
import { Promise } from 'rsvp';
 | 
						|
 | 
						|
export default Route.extend({
 | 
						|
 | 
						|
  storage: service(),
 | 
						|
 | 
						|
  beforeModel() {
 | 
						|
    return this.waitForConnectionState().then(() => {
 | 
						|
      if (this.get('storage.connected')) {
 | 
						|
        this.transitionTo('index');
 | 
						|
      }
 | 
						|
    });
 | 
						|
  },
 | 
						|
 | 
						|
  waitForConnectionState() {
 | 
						|
    let self = this;
 | 
						|
 | 
						|
    return new Promise(resolve => {
 | 
						|
      function checkConnectingDone() {
 | 
						|
        if (self.get('storage.connecting')) {
 | 
						|
          later(checkConnectingDone, 20);
 | 
						|
        } else {
 | 
						|
          resolve();
 | 
						|
        }
 | 
						|
      }
 | 
						|
      checkConnectingDone();
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
});
 |