grafana/public/app/features/teams/CreateTeamCtrl.ts
2018-11-23 13:44:59 +01:00

27 lines
607 B
TypeScript

import coreModule from 'app/core/core_module';
export class CreateTeamCtrl {
name: string;
email: string;
navModel: any;
/** @ngInject */
constructor(private backendSrv, private $location, navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'teams', 0);
}
create() {
const payload = {
name: this.name,
email: this.email,
};
this.backendSrv.post('/api/teams', payload).then(result => {
if (result.teamId) {
this.$location.path('/org/teams/edit/' + result.teamId);
}
});
}
}
coreModule.controller('CreateTeamCtrl', CreateTeamCtrl);