diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-01-29 17:41:32 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-01-29 17:41:32 +0200 |
| commit | c1b185a27a630e67916bca76db7610cfc4fba18f (patch) | |
| tree | f7a33664306b74d3e1e027775d1fde96a157cb01 | |
| parent | 18e7ba3a2ee9460905507ba1f1605bc7a4fdd150 (diff) | |
| download | DevHive-c1b185a27a630e67916bca76db7610cfc4fba18f.tar DevHive-c1b185a27a630e67916bca76db7610cfc4fba18f.tar.gz DevHive-c1b185a27a630e67916bca76db7610cfc4fba18f.zip | |
Implemented functionality and rough UI in profile settings forUpdated profile component to use language and technology service methods
| -rw-r--r-- | src/DevHive.Angular/src/app/components/profile/profile.component.ts | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/src/DevHive.Angular/src/app/components/profile/profile.component.ts b/src/DevHive.Angular/src/app/components/profile/profile.component.ts index 5bc1976..69d7e72 100644 --- a/src/DevHive.Angular/src/app/components/profile/profile.component.ts +++ b/src/DevHive.Angular/src/app/components/profile/profile.component.ts @@ -42,21 +42,12 @@ export class ProfileComponent implements OnInit { Object.assign(this.user, res); if (this.user.languages.length > 0) { - // For each language in the user, request it's name and assign it, - // when you finally finish with them, start loading technologies - const lastGuid = this.user.languages[this.user.languages.length - 1].id; - for (const lang of this.user.languages) { - this._languageService.getLanguageRequest(lang.id).subscribe( - (result: object) => { - // this only assigns the response "name" property to language - Object.assign(lang, result); - - if (lastGuid === lang.id) { - this.loadTechnologies(); - } - } - ); - } + // When user has languages, get their names and load technologies + this._languageService.getFullLanguagesFromIncomplete(this.user.languages) + .then(value => { + this.user.languages = value; + this.loadTechnologies(); + }); } else { this.showNoLangMsg = true; @@ -66,21 +57,12 @@ export class ProfileComponent implements OnInit { private loadTechnologies(): void { if (this.user.technologies.length > 0) { - // For each language in the user, request it's name and assign it, - // when you finish with them, finally finish user loading - const lastGuid = this.user.technologies[this.user.technologies.length - 1].id; - for (const tech of this.user.technologies) { - this._technologyService.getTechnologyRequest(tech.id).subscribe( - (result: object) => { - // this only assigns the response "name" property to technology - Object.assign(tech, result); - - if (lastGuid === tech.id) { - this.finishUserLoading(); - } - } - ); - } + // When user has technologies, get their names and finally finish loading + this._technologyService.getFullTechnologiesFromIncomplete(this.user.technologies) + .then(value => { + this.user.technologies = value; + this.finishUserLoading(); + }); } else { this.showNoTechMsg = true; |
