67P/hyperchannel

View on GitHub
app/routes/index.js

Summary

Maintainability
A
0 mins
Test Coverage
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class IndexRoute extends Route {

  @service localData;
  @service coms;

  get userSettings () {
    return this.localData.stores.userSettings;
  }

  async redirect () {
    const currentChannel = await this.userSettings.getItem('currentChannel');

    if (currentChannel) {
      this.transitionTo('channel', currentChannel);
    } else {
      this.transitionTo('channel', this.coms.channels.firstObject);
    }
  }

}