diff options
Diffstat (limited to 'src/app/create-identity/create-identity.component.ts')
-rw-r--r-- | src/app/create-identity/create-identity.component.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/app/create-identity/create-identity.component.ts b/src/app/create-identity/create-identity.component.ts new file mode 100644 index 0000000..2ba7fce --- /dev/null +++ b/src/app/create-identity/create-identity.component.ts | |||
@@ -0,0 +1,35 @@ | |||
1 | import { Component, OnInit } from '@angular/core'; | ||
2 | |||
3 | import { ApiService } from '../api.service'; | ||
4 | import { IdentityPageComponent } from '../identity-page/identity-page.component'; | ||
5 | |||
6 | @Component({ | ||
7 | selector: 'create-identity-component', | ||
8 | templateUrl: './create-identity.component.html' | ||
9 | }) | ||
10 | export class CreateIdentityComponent implements OnInit { | ||
11 | |||
12 | private input_text: string = ''; | ||
13 | private json: any = {'name':''}; | ||
14 | private is_free:boolean = true; | ||
15 | |||
16 | constructor(private apiService: ApiService, | ||
17 | private identity: IdentityPageComponent) { } | ||
18 | |||
19 | ngOnInit() { | ||
20 | } | ||
21 | |||
22 | onClick() { | ||
23 | if (this.input_text != "" && this.is_free){ | ||
24 | this.is_free = false; | ||
25 | this.json.name = this.input_text; | ||
26 | this.apiService.createIdentity(this.json).subscribe(test => { | ||
27 | this.identity.getAPIs(); | ||
28 | this.is_free = true; | ||
29 | }); | ||
30 | } else { | ||
31 | alert("No input"); | ||
32 | } | ||
33 | } | ||
34 | |||
35 | } | ||