Skip to content

Commit b18087f

Browse files
committed
cosas varias
1 parent 71ae823 commit b18087f

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

frontend/src/app/app.routing.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { HomeComponent } from './components/home/home.component';
66
import { NewsComponent } from './components/news/news.component';
77
import { ShowNewsComponent } from './components/news/showNews.component';
88
import { UserProfile } from './components/user/userProfile.component';
9+
import { LoginComponent } from './components/login/login.component';
910

1011
//aquí tenemos que completar todo lo que queremos que se vaya cargando en el router-outlet
1112
//ojo, el template no debe llamar al servicio, hay que hacerlo a través del componente
@@ -14,9 +15,10 @@ const appRoutes = [
1415
{ path: 'home', component: HomeComponent },
1516
{ path: 'news', component: NewsComponent },
1617
{ path: 'showNews/:id', component: ShowNewsComponent},
17-
{ path: 'userProfile', component: UserProfile},
18+
{ path: 'userProfile/:id', component: UserProfile},
1819
{ path: 'videogamecatalog', component: VideogameCatalogComponent },
1920
{ path: 'videogame/:id', component: VideogameDetailComponent },
21+
{ path: 'login', component: LoginComponent},
2022
{ path: '', redirectTo: 'home', pathMatch: 'full' }
2123

2224
]

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

Whitespace-only changes.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<div *ngIf="user" class="container rounded bg-white mt-5 mb-5">
1+
<a>hola kk</a>
2+
<div class="container rounded bg-white mt-5 mb-5">
23
<div class="row">
34
<div class="col-md-3 border-right">
45
<div class="d-flex flex-column align-items-center text-center p-3 py-5"><img class="rounded-circle mt-5"
@@ -12,7 +13,7 @@
1213

1314
<div class="col-md-5 border-right">
1415
<div class="p-3 py-5">
15-
<form *ngIf="user">
16+
<form>
1617
<div class="d-flex justify-content-between align-items-center mb-3">
1718
<h4 class="text-right">Mi perfil: "{{user.nick}}"</h4>
1819
</div>
@@ -35,7 +36,6 @@ <h3>"{{user.lastName}}"</h3>
3536
[(ngModel)]="user.email">
3637
</div>
3738

38-
3939
<div class="col-md-12"><label class="labels">Número de tarjeta</label>
4040
<input *ngIf="user.creditCard" name="creditCard" type="text" class="form-control" placeholder="123456789A"
4141
[(ngModel)]="user.creditCard">

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class UserProfile {
2323
const id = activatedRoute.snapshot.params['id'];
2424
if (id) {
2525
useroService.getUser(id).subscribe(
26-
(user: Usero) => user = user,
26+
(user: Usero) => {this.user = user},
2727
(error: any) => console.error(error)
2828
);
2929
}
@@ -33,6 +33,9 @@ export class UserProfile {
3333
);
3434
}
3535

36+
ngOnInit(){
37+
alert(this.user);
38+
}
3639

3740
save(){
3841
this.useroService.updateUser(this.user).subscribe(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { News } from '../models/news.model';
66
import { Observable, throwError } from 'rxjs';
77
import { catchError } from 'rxjs/operators';
88

9-
const BASE_URL = '/api/users';
9+
const BASE_URL = '/api/users/';
1010

1111
@Injectable({ providedIn: 'root' })
1212
export class UseroService {

0 commit comments

Comments
 (0)