Profile creation part completed

This commit is contained in:
Anish Gurung 2024-03-21 18:13:58 -07:00
parent f75e93e3eb
commit f0a980b182
6 changed files with 21 additions and 29 deletions

View file

@ -77,10 +77,12 @@
<h2>Certifications</h2>
<ul>
<li *ngFor="let cert of userCertificates">
<p><strong>Certificate Name:</strong> {{ cert.certificateName }}</p>
<p><strong>Issuer:</strong> {{ cert.certificateIssuer }}</p>
<p><strong>Year:</strong> {{ cert.certificateYear }}</p>
<p><strong>Relevance:</strong> {{ cert.certificateRelevance }}</p>
<p><strong>Certificate Name:</strong> {{ cert.name }}</p>
<p><strong>Issuer:</strong> {{ cert.issuer }}</p>
<p>
<strong>Date:</strong> {{ cert.startDate }} - {{ cert.endDate }}
</p>
<p><strong>Relevance:</strong> {{ cert.description }}</p>
</li>
</ul>
</div>

View file

@ -23,10 +23,13 @@ export class ProfileComponent implements OnInit {
this.route.queryParams.subscribe((params) => {
const userId = params['userId']; // Get the userId from query params
console.log(userId);
if (userId) {
this.userAPI.getUserDetails(userId).subscribe((response) => {
if (response.success) {
this.userDetails = response.data;
console.log(this.userDetails)
this.userExperiences = this.userDetails.experiences || [];
this.userEducation = this.userDetails.education || [];
this.userProjects = this.userDetails.projects || [];

View file

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Router, NavigationExtras } from '@angular/router';
import { Router } from '@angular/router';
import { UserAPI } from '../../../service/api/user-api.service';
@ -99,26 +99,18 @@ export class StepperComponent implements OnInit {
// Save personal details including professional summary
const userDetailsResponse = await this.userAPI.saveUserDetails(personalDetailsWithSummary).toPromise();
this.userId = userDetailsResponse.data.id;
console.log(this.userId)
// Save other details using the obtained user ID
await Promise.all([
this.userAPI.saveExperience(this.experience.value, this.userId).toPromise(),
this.userAPI.saveEducation(this.education.value, this.userId).toPromise(),
this.userAPI.saveProjects(this.project.value, this.userId).toPromise(),
this.userAPI.saveSkills(this.skills.value, this.userId).toPromise(),
this.userAPI.saveCertifications(this.certifications.value, this.userId).toPromise()
]);
await this.userAPI.saveExperience(this.experience.value, this.userId).toPromise();
await this.userAPI.saveEducation(this.education.value, this.userId).toPromise();
await this.userAPI.saveProjects(this.project.value, this.userId).toPromise();
await this.userAPI.saveSkills(this.skills.value, this.userId).toPromise();
await this.userAPI.saveCertifications(this.certifications.value, this.userId).toPromise();
console.log("userID: ", this.userId)
// Navigate to the profile page
const navigationExtras: NavigationExtras = {
queryParams: { userId: this.userId }
};
this.router.navigateByUrl('/pages/layout/stepper/profile', navigationExtras);
this.router.navigateByUrl(`/pages/layout/stepper/profile?userId=${this.userId}`);
} catch (error) {
console.error('Error occurred while saving user details:', error);
// Handle error