Skip to content

Commit

Permalink
feat: fix route, redirect to refuge list
Browse files Browse the repository at this point in the history
  • Loading branch information
oriolagobat committed Oct 25, 2023
1 parent 4e9e8f8 commit 6acdbd3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/src/app/pages/refuges/refuge-update/refuge-udpate.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,18 @@ export class RefugeUdpatePage implements OnInit {

private handleUpdateRefugeResponse(response: UpdateRefugeResponse) {
match(response)
.with({ status: 'updated' }, (response) => {
this.handleCorrectCreateRefugeResponse(response.data);
.with({ status: 'updated' }, () => {
this.handleCorrectCreateRefugeResponse();
})
.with({ status: 'error' }, async (response) => {
this.handleError(response.error);
})
.exhaustive();
}

private handleCorrectCreateRefugeResponse(refuge: Refuge) {
private handleCorrectCreateRefugeResponse() {
this.loadingController.dismiss().then(() => {
this.router.navigate(['refuges', refuge.id]).then();
this.router.navigate(['refuges']).then();
});
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/app/services/refuge/refuge.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class RefugeService {
refuge: UpdateRefuge,
): Observable<UpdateRefugeResponse> {
const endpoint = this.updateRefugeEndpoint(refuge.id);
return this.http.post<Refuge>(endpoint, refuge).pipe(
return this.http.put<Refuge>(endpoint, refuge).pipe(
map((response: Refuge) => updateRefugeResponseFromResponse(response)),
catchError((err: HttpErrorResponse) =>
of(updateRefugeResponseFromError(err)),
Expand Down

0 comments on commit 6acdbd3

Please sign in to comment.