* style: 💄 Update trailing commas in API * style: 💄 Update trailing commas in core * style: 💄 Update trailing commas in rose * style: 💄 Update trailing commas in admin * style: 💄 Update trailing commas in desktop
32 lines
698 B
JavaScript
32 lines
698 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import Route from '@ember/routing/route';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class ScopesScopeAuthenticateIndexRoute extends Route {
|
|
// =services
|
|
|
|
@service router;
|
|
|
|
// =methods
|
|
|
|
/**
|
|
* This index route exists solely to redirect the user on to the
|
|
* first auth method.
|
|
* @param {object} model
|
|
* @param {[AuthMethodModel]} model.authMethods
|
|
*/
|
|
redirect({ authMethods }) {
|
|
const firstAuthMethod = authMethods[0];
|
|
if (firstAuthMethod) {
|
|
this.router.transitionTo(
|
|
'scopes.scope.authenticate.method',
|
|
firstAuthMethod,
|
|
);
|
|
}
|
|
}
|
|
}
|