ngx-admin/src/app/pages/layout/stepper/profile/profile.component.ts

50 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-03-21 15:32:11 -07:00
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { UserAPI } from '../../../../service/api/user-api.service';
2024-03-20 22:31:55 -07:00
@Component({
selector: 'ngx-profile',
templateUrl: './profile.component.html',
2024-03-21 15:32:11 -07:00
styleUrls: ['./profile.component.scss'],
2024-03-20 22:31:55 -07:00
})
2024-03-21 15:32:11 -07:00
export class ProfileComponent implements OnInit {
userDetails: any = {};
userExperiences: any[] = [];
userEducation: any[] = [];
userProjects: any[] = [];
userSkills: any[] = [];
userCertificates: any[] = [];
// userResumes: any[] = [];
// userCoverLetters: any[] = [];
2024-03-20 22:31:55 -07:00
2024-03-21 15:32:11 -07:00
constructor(private route: ActivatedRoute, private userAPI: UserAPI) {}
ngOnInit(): void {
this.route.queryParams.subscribe((params) => {
const userId = params['userId']; // Get the userId from query params
2024-03-21 18:13:58 -07:00
console.log(userId);
2024-03-21 15:32:11 -07:00
if (userId) {
this.userAPI.getUserDetails(userId).subscribe((response) => {
if (response.success) {
this.userDetails = response.data;
2024-03-21 18:13:58 -07:00
console.log(this.userDetails)
2024-03-21 15:32:11 -07:00
this.userExperiences = this.userDetails.experiences || [];
this.userEducation = this.userDetails.education || [];
this.userProjects = this.userDetails.projects || [];
this.userSkills = this.userDetails.skills || [];
this.userCertificates = this.userDetails.certificates || [];
// this.userResumes = this.userDetails.resumes || [];
// this.userCoverLetters = this.userDetails.coverLetters || [];
} else {
console.error('Failed to retrieve user details:', response.message);
}
});
} else {
console.error('User ID not found in query parameters.');
}
});
}
2024-03-20 22:31:55 -07:00
}