aboutsummaryrefslogtreecommitdiff
path: root/src/app/create-identity/create-identity.component.ts
blob: 2ba7fce32da2db7b7dbe79226f168911441dd314 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Component, OnInit } from '@angular/core';

import { ApiService } from '../api.service';
import { IdentityPageComponent } from '../identity-page/identity-page.component';

@Component({
  selector: 'create-identity-component',
  templateUrl: './create-identity.component.html'
})
export class CreateIdentityComponent implements OnInit {

  private input_text: string = '';
  private json: any = {'name':''};
  private is_free:boolean = true;

  constructor(private apiService: ApiService,
              private identity: IdentityPageComponent) { }

  ngOnInit() {
  }

  onClick() {
    if (this.input_text != "" && this.is_free){
      this.is_free = false;
      this.json.name = this.input_text;
      this.apiService.createIdentity(this.json).subscribe(test => {
        this.identity.getAPIs();
        this.is_free = true;
      });
    } else {
      alert("No input");
    }
  }

}