mirror of
https://github.com/grafana/grafana.git
synced 2025-01-27 08:47:12 -06:00
0ef4060b98
* Fix 200 ish errors * Add interface
30 lines
806 B
TypeScript
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);
|