Skip to content

Commit fc2ca99

Browse files
committed
cambios userProfile
1 parent e188758 commit fc2ca99

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

frontend/src/app/app.routing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const appRoutes = [
1919
{ path: 'videogamecatalog', component: VideogameCatalogComponent },
2020
{ path: 'videogame/:id', component: VideogameDetailComponent },
2121
{ path: 'login', component: LoginComponent},
22-
{ path: '**', redirectTo: 'home', pathMatch: 'full' }
22+
{ path: '', redirectTo: 'home', pathMatch: 'full' }
2323

2424
]
2525

frontend/src/app/components/carousel/carousel.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { NgbCarouselConfig } from '@ng-bootstrap/ng-bootstrap';
33

44
@Component({
55
selector: 'app-carousel',
6-
templateUrl: './carousel.component.html',
7-
styleUrls: ['./carousel.component.css']
6+
templateUrl: './carousel.component.html'
87
})
98
export class CarouselComponent implements OnInit {
109

frontend/src/app/components/login/login.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h1 class="fw-bolder text-white">Inicio de sesión</h1>
1313
<div class="card-body">
1414
<h3 class="card-title text-center">Login</h3>
1515
<div class="card-text">
16-
<form *ngIf="!loginService.isLogged()">
16+
<form>
1717
<!-- to error: add class "has-danger" -->
1818
<div class="form-group">
1919
<label>Nombre Usuario:</label>

frontend/src/app/components/user/userProfile.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a>hola kk</a>
1+
22
<div class="container rounded bg-white mt-5 mb-5">
33
<div class="row">
44
<div class="col-md-3 border-right">

frontend/src/app/components/user/userProfile.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export class UserProfile {
1919
file: any;
2020
removeImage? :boolean;
2121

22-
constructor(private router: Router,public useroService: UseroService, public loginservice : LoginService) {
23-
const id:number = 2;
22+
constructor(private router: Router, activatedRoute: ActivatedRoute, public useroService: UseroService, public loginservice : LoginService) {
23+
const id = activatedRoute.snapshot.params['id'];
2424
if (id) {
2525
useroService.getUser(id).subscribe(
2626
user => this.user = user as Usero,
@@ -43,6 +43,10 @@ export class UserProfile {
4343
(user: any) => this.uploadImage(user),
4444
(error: string) => alert('Error al guardar los datos: ' + error)
4545
);
46+
this.useroService.getVideogames(this.user).subscribe(
47+
videogame => this.videogame = videogame as Videogame[],
48+
error => console.error(error)
49+
);
4650
}
4751
cancel(){
4852
window.history.back();

frontend/src/app/services/login.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ export class LoginService {
99

1010
//Check these 2 lines, i've added '?' to both of them
1111
logged: boolean = false;
12-
user?: Usero;
12+
user: Usero | undefined;
1313

1414
constructor(private http: HttpClient) {
1515
this.reqIsLogged();
16+
this.logged;
1617
}
1718

1819
reqIsLogged() {

frontend/src/app/services/usero.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ export class UseroService {
6868
}
6969
}
7070

71-
updateUser(user: Usero) {
71+
updateUser(user: Usero) : Observable<Usero>{
7272
return this.http.put(BASE_URL + user.id, user).pipe(
73-
catchError((error: any) => this.handleError(error))
74-
);
73+
//catchError((error: any) => this.handleError(error))
74+
)as Observable<Usero>;
7575
}
7676

7777
/*------------------IMAGE METHODS------------------*/

0 commit comments

Comments
 (0)