diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-03-29 15:22:56 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-03-29 15:22:56 +0300 |
| commit | 350657be9db0b51c06ccba2dd3e3a4b1702bcfb1 (patch) | |
| tree | 3d96f856aa019b1ef51d43756e54e2ae1af16877 /src | |
| parent | 8c2893557a5a03076746fcc91ca7db1edadae9e8 (diff) | |
| download | DevHive-Angular-350657be9db0b51c06ccba2dd3e3a4b1702bcfb1.tar DevHive-Angular-350657be9db0b51c06ccba2dd3e3a4b1702bcfb1.tar.gz DevHive-Angular-350657be9db0b51c06ccba2dd3e3a4b1702bcfb1.zip | |
Fixed loading of avaiable languages and technologies in profile settings page
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/components/profile-settings/profile-settings.component.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/app/components/profile-settings/profile-settings.component.ts b/src/app/components/profile-settings/profile-settings.component.ts index 007ce28..4bee52e 100644 --- a/src/app/components/profile-settings/profile-settings.component.ts +++ b/src/app/components/profile-settings/profile-settings.component.ts @@ -108,24 +108,34 @@ export class ProfileSettingsComponent implements OnInit { this._languageService.getFullLanguagesFromIncomplete(this.user.languages).then( (result) => { this.chosenLanguages = result as Language[]; + this.loadAvailableLanguages(); } ); this._technologyService.getFullTechnologiesFromIncomplete(this.user.technologies).then( (result) => { this.chosenTechnologies = result as Technology[]; + this.loadAvailableTechnologies(); } ); + } - // Load avaiable languages and technologies + private loadAvailableLanguages(): void { this._languageService.getAllLanguagesWithSessionStorageRequest().subscribe({ next: (result: object) => { - this.availableLanguages = result as Language[]; + const allAvailable = result as Language[]; + // Remove the chosen languages from all of the avaiable ones + this.availableLanguages = allAvailable.filter(a => !this.user.languages.some(l => l.name === a.name)); } }); + } + + private loadAvailableTechnologies(): void { this._technologyService.getAllTechnologiesWithSessionStorageRequest().subscribe({ next: (result: object) => { - this.availableTechnologies = result as Technology[]; + const allAvailable = result as Technology[]; + // Remove the chosen technologies from all of the avaiable ones + this.availableTechnologies = allAvailable.filter(a => !this.user.technologies.some(t => t.name === a.name)); } }); } |
