Skip to content

Commit 7287bc2

Browse files
committed
profile updated
1 parent 0fb5019 commit 7287bc2

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

codecamp-front/src/app/components/login/login.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export class LoginComponent implements OnInit {
3838
username: this.form.get('username').value, // Username input field
3939
password: this.form.get('password').value // Password input field
4040
};
41-
console.log(user);
4241
this.authService.loginUser(user).subscribe(data => {
4342
this.authService.storeUserData(data.token, data.user, data.isAdmin);
4443
// After 2 seconds, redirect to dashboard page

codecamp-front/src/app/components/profile/profile.component.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ <h2 class="page-header">{{user.name}}</h2>
33
<ul class="list-group">
44
<li class="list-group-item">Username: {{user.username}}</li>
55
<li class="list-group-item">Email: {{user.email_id}}</li>
6-
<li class="list-group-item">Name: {{user.name}}</li>
6+
<li class="list-group-item">Name: {{ user.name }}</li>
7+
<li class="list-group-item">College: {{ user.college }}</li>
8+
<li class="list-group-item">Date Of Birth: {{ user.dob }}</li>
9+
<li class="list-group-item">City: {{ user.city }}</li>
10+
<li class="list-group-item">Gender: {{ user.gender }}</li>
711
</ul>
8-
</div>
12+
</div>

codecamp-front/src/app/components/profile/profile.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import { Router } from '@angular/router';
99
})
1010
export class ProfileComponent implements OnInit {
1111

12-
user: Object;
12+
user;
1313
constructor(
1414
private authService: AuthService,
1515
private router: Router
1616
) {
1717
this.user = authService.getprofile().subscribe(profile => {
18-
this.user = profile.username;
18+
this.user = profile.msg;
1919
});
2020
console.log(this.user);
2121
}

codecamp-front/src/app/services/auth.service.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ export class AuthService {
2929
}
3030

3131
loadToken() {
32-
<<<<<<< HEAD
3332
this.authToken = localStorage.getItem('token');
3433
console.log(this.authToken); // Get token and asssign to variable to be used elsewhere
35-
=======
36-
this.authToken = localStorage.getItem('token'); // Get token and asssign to variable to be used elsewhere
37-
>>>>>>> 284547cb710a93fde32823f40edc4d4f83454bdd
3834
}
3935
registerUser(user) {
4036
return this.http.post(this.domain + '/users/signup', user)
@@ -73,6 +69,7 @@ export class AuthService {
7369
localStorage.clear(); // Clear local storage
7470
}
7571
getprofile() {
76-
return this.http.get(this.domain + '/users/profile').map(res => res.json());
72+
this.createAuthenticationHeaders();
73+
return this.http.get(this.domain + '/users/profile', this.options).map(res => res.json());
7774
}
7875
}

0 commit comments

Comments
 (0)