Skip to content
Permalink
500414c849
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
45 lines (38 sloc) 1.29 KB
import { Component, OnInit } from '@angular/core';
import { GeneratorService } from '../services/generator.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-generator-search',
templateUrl: './generator-search.component.html',
styleUrls: ['./generator-search.component.css']
})
export class GeneratorSearchComponent implements OnInit {
constructor(public data: GeneratorService, private router: Router) { }
public generators$: Object;
goToGenerator(gen_id, org_id, gen_name) {
this.router.navigateByUrl('/statistics');
// console.log(gen_id);
// console.log(org_id);
localStorage.setItem('gen_id', gen_id);
localStorage.setItem('org_id', org_id);
localStorage.setItem('gen_name', gen_name);
}
ngOnInit() {
localStorage.removeItem('gen_id');
localStorage.removeItem('org_id');
localStorage.removeItem('gen_name');
localStorage.removeItem('data_type');
localStorage.removeItem('fault_type');
const jsonToken = localStorage.getItem('auth_token');
try {
this.data.getGenerators(jsonToken).subscribe((data) => {
// console.log(data);
this.generators$ = data;
return this.generators$;
});
} catch (err) {
return err;
}
// this.generators$ = this.getGeneratorName();
}
}