Skip to content

Commit

Permalink
fix : return empty array when error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
cho4u4o committed Oct 20, 2024
1 parent 1f8a7de commit 9e0d197
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/screens/products/item_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class _ItemListPageState extends State<ItemListPage> {
.toList();
return products;
} else {
throw Exception('No results found in the response');
return [];
}
} else {
throw Exception('Failed to load products');
return [];
}
} catch (e) {
return [];
Expand Down
3 changes: 1 addition & 2 deletions lib/screens/products/liked_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,8 @@ class _LikedListPageState extends State<LikedListPage> {
return InkWell(
onTap: () {
setState(() {
// URL에 따라 제품을 다시 가져오고, 상태를 업데이트합니다.
_products = getProducts(url);
countProducts(url); // 필터에 맞는 제품 개수를 카운트합니다.
countProducts(url);
});
},
child: Container(
Expand Down

0 comments on commit 9e0d197

Please sign in to comment.