Files
threshold-ui/ui/desktop/app/routes/scopes/scope/projects.js
T
Susmitha Girumala 68107589bb refactor: Scope service into core addon and desktop routes
Ensure top-level scopes route within ui/admin and ui/desktop are exactly
the same in preparation for future refactor.

feat: Add projects/targets route

chore: yarn:format output in ui/desktop

test: Add basic acceptance tests for projects and targets
2020-11-23 16:22:34 -05:00

29 lines
629 B
JavaScript

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsRoute extends Route {
// =services
@service session;
// =methods
/**
* If arriving here unauthenticated, redirect to index for further processing.
*/
beforeModel() {
if (!this.session.isAuthenticated) this.transitionTo('index');
}
/**
* Loads project scopes for the current scope.
* @return {Promise
*/
model() {
const currentScope = this.modelFor('scopes.scope');
return this.store.query('scope', {
scope_id: currentScope.id,
});
}
}