aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Angular
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Angular')
-rw-r--r--src/DevHive.Angular/src/app/components/profile/profile.component.ts42
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;