Skip to content

Commit

Permalink
Formata a string de vinculo do usuário
Browse files Browse the repository at this point in the history
Co-authored-by: cansancaojennifer <[email protected]>
  • Loading branch information
GabrielaTiago and cansancaojennifer committed Dec 1, 2023
1 parent 5cfcb9f commit 7e23c02
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/pages/profile/profile.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div
class="w-full h-8 flex justify-center items-center font-normal text-[12px] text-[#3c3c3b]"
>
{{ user.connection }}
{{ connection }}
</div>
</div>

Expand Down
17 changes: 10 additions & 7 deletions src/app/pages/profile/profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { HttpErrorResponse } from '@angular/common/http';

type ErrorResponseType = HttpErrorResponse;


@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
Expand All @@ -19,6 +18,7 @@ type ErrorResponseType = HttpErrorResponse;
export class ProfileComponent {
user: any;
userId: any;
connection: string = '';

constructor(
private router: Router,
Expand All @@ -27,7 +27,7 @@ export class ProfileComponent {
private alertService: AlertService,
private confirmationService: ConfirmationService,
private authService: AuthService
) { }
) {}

ngOnInit(): void {
this.setUserIdFromToken(localStorage.getItem('token') as string);
Expand All @@ -43,6 +43,7 @@ export class ProfileComponent {
this.userService.getUser(this.userId).subscribe({
next: (data) => {
this.user = data;
this.connection = this.formatingConnection(this.user.connection);
},
error: (error: ErrorResponseType) => {
console.log(error);
Expand All @@ -60,8 +61,7 @@ export class ProfileComponent {
accept: () => {
this.authService.logout();
},
reject: () => {
},
reject: () => {},
});
}

Expand All @@ -87,13 +87,16 @@ export class ProfileComponent {
},
});
},
reject: () => {
},
reject: () => {},
});

}

navigatorEdit(): void {
this.router.navigate([`/editUser/${this.user.id}`]);
}

formatingConnection(value: string): string {
let str = value.toLowerCase();
return str.charAt(0).toUpperCase() + str.slice(1);
}
}

0 comments on commit 7e23c02

Please sign in to comment.