Skip to content

Commit 905d7a3

Browse files
author
stefanodallapalma
committed
Added if condition on response.status before showing message
1 parent d04b839 commit 905d7a3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

defuse/src/app/modules/repository-list/repository-list.component.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ export class RepositoryListComponent implements OnInit {
102102
*/
103103
onDelete(id){
104104
this._repositoryListService.delete(id)
105-
.subscribe(deleted => {
106-
this._snackBar.open('Repository deleted!', 'Dismiss', {
107-
duration: 5000,
108-
panelClass: ['custom-snack-bar']
109-
});
105+
.subscribe(response => {
106+
if (response.status == 204){
107+
this._snackBar.open('Repository deleted!', 'Dismiss', {
108+
duration: 5000,
109+
panelClass: ['custom-snack-bar']
110+
});
111+
}
110112
});
111113
}
112114

@@ -121,11 +123,11 @@ export class RepositoryListComponent implements OnInit {
121123

122124
onScore(id: number){
123125
this._repositoryListService.score(id)
124-
.subscribe(deleted => {
125-
this._snackBar.open('Scoring started!', 'Dismiss', {
126-
duration: 5000,
127-
panelClass: ['custom-snack-bar']
128-
});
126+
.subscribe(response => {
127+
128+
if (response.status == 200){
129+
this._snackBar.open('Scoring started!', 'Dismiss', {duration: 5000, panelClass: ['custom-snack-bar']});
130+
}
129131
});
130132
}
131133

0 commit comments

Comments
 (0)