Skip to content

Commit

Permalink
Merge pull request #374 from raffacabofrio/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wantero authored Dec 6, 2021
2 parents 480d783 + a0ad4ef commit 4586817
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1 class="text-center display-4">Consentimento dos pais ou responsável</h1>
usuários.
</p>

<div class="form-row" *ngIf="!aproved">
<div class="form-row" *ngIf="state == 'ready'">
<div class="col">
<div class="form-group col-md-6 offset-md-3">
<div class="text-center">
Expand All @@ -23,5 +23,9 @@ <h1 class="text-center display-4">Consentimento dos pais ou responsável</h1>
</div>
</div>

<div class="alert alert-success" role="alert" *ngIf="aproved">Acesso liberado com sucesso.</div>
<div class="alert alert-success" role="alert" *ngIf="state == 'approved'">Acesso liberado com sucesso.</div>

<div *ngIf="state == 'loading'"><mat-spinner></mat-spinner></div>

<div class="alert alert-danger" role="alert" *ngIf="state == 'error'">{{ errorMsg }}</div>
</div>
9 changes: 7 additions & 2 deletions src/app/components/parent-aproval/parent-aproval.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { UserService } from '../../core/services/user/user.service';
export class ParentAprovalComponent implements OnInit, OnDestroy {
private _destroySubscribes$ = new Subject<void>();
public hashCode = '';
public aproved = false;
public state = 'ready';
public errorMsg = '';

constructor(private _activatedRoute: ActivatedRoute, private _scUser: UserService, private _toastr: ToastrService) {}

Expand All @@ -25,16 +26,20 @@ export class ParentAprovalComponent implements OnInit, OnDestroy {
}

parentAproval() {
this.state = 'loading';

this._scUser
.parentAproval(this.hashCode)
.pipe(takeUntil(this._destroySubscribes$))
.subscribe(
(data) => {
this._toastr.success('Acesso liberado com sucesso. Obrigado.');
this.aproved = true;
this.state = 'approved';
},
(error) => {
this._toastr.error(error);
this.state = 'error';
this.errorMsg = error;
}
);
}
Expand Down

0 comments on commit 4586817

Please sign in to comment.