oncomplete only runs on successful api calls,

https://stackoverflow.com/questions/33783967/rxjs-observable-doesnt-complete-when-an-error-occurs
This commit is contained in:
Jason Kulatunga 2022-09-25 11:14:00 -07:00
parent 8e188144cd
commit 14fd443dc4
3 changed files with 19 additions and 6 deletions

View File

@ -22,5 +22,6 @@ FROM gcr.io/distroless/static-debian11
COPY --from=frontend-build /usr/src/fastenhealth/dist /opt/fasten/dist
COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten
COPY LICENSE.md /opt/fasten/LICENSE.md
COPY config.yaml /opt/fasten/config.yaml
CMD ["/opt/fasten/fasten"]

View File

@ -13,6 +13,9 @@
<div class="card h-100 d-flex align-items-center justify-content-center p-3 rounded-0 cursor-pointer">
<div (click)="openModal(contentModalRef, sourceInfo)" class="card-body">
<img [src]="'assets/sources/'+sourceInfo.metadata['source_type']+'.png'" alt="client" class="img-fluid">
<div *ngIf="status[sourceInfo.source['source_type']]" class="progress">
<div [style.width]="status[sourceInfo.source['source_type']] == 'authorize' ? '33%' : '66%'" class="bg-indigo progress-bar progress-bar-striped progress-bar-animated" role="progressbar"></div>
</div>
</div>
</div>
</div>

View File

@ -160,13 +160,16 @@ export class MedicalSourcesComponent implements OnInit {
await this.fastenApi.createSource(sourceCredential).subscribe(
(respData) => {
console.log("source credential create response:", respData)
},
(err) => {console.log(err)},
() => {
delete this.status[sourceType]
//reload the current page after finishing connection
window.location.reload();
console.log("source credential create response:", respData)
},
(err) => {
delete this.status[sourceType]
window.location.reload();
console.log(err)
}
)
@ -214,12 +217,18 @@ export class MedicalSourcesComponent implements OnInit {
}
syncSource(source: Source){
this.status[source.source_type] = "authorize"
this.modalService.dismissAll()
this.fastenApi.syncSource(source.id).subscribe(
(respData) => {
delete this.status[source.source_type]
console.log("source sync response:", respData)
},
(err) => {console.log(err)},
(err) => {
delete this.status[source.source_type]
console.log(err)
}
)
}