grafana/public/app/features/teams/CreateTeamCtrl.ts
Tobias Skarhed 0ef4060b98
Chore: Fix about 200 noImplicitAny errors (#18067)
* Fix 200 ish errors

* Add interface
2019-07-16 11:35:42 +02:00

30 lines
806 B
TypeScript

import coreModule from 'app/core/core_module';
import { BackendSrv } from 'app/core/services/backend_srv';
import { ILocationService } from 'angular';
import { NavModelSrv } from 'app/core/core';
export class CreateTeamCtrl {
name: string;
email: string;
navModel: any;
/** @ngInject */
constructor(private backendSrv: BackendSrv, private $location: ILocationService, navModelSrv: 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: any) => {
if (result.teamId) {
this.$location.path('/org/teams/edit/' + result.teamId);
}
});
}
}
coreModule.controller('CreateTeamCtrl', CreateTeamCtrl);