-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
post_write_page.dart에서 게시판 목록 caching #178
Conversation
updateStateWithCachedOrFetchedApiData 함수를 사용해 게시판 목록 caching 기능 추가.
lib/pages/post_write_page.dart
Outdated
apiUrl: "boards/", // API URL을 지정합니다. 이 예에서는 "boards/"를 대상으로 합니다. | ||
userProvider: userProvider, // API 요청을 담당할 userProvider 인스턴스를 전달합니다. | ||
callback: (response) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DioException은 updateStateWithCatchedOrFetchedApiData 함수 내에서 userProvider.getApiRes가 처리하기 때문에 여기서 처리하실 필요 없습니다. callback 내부를
if (mounted) {
setState(() {
// `_boardList` 초기화 후 기본 게시판 추가.
_boardList = [_defaultBoardDetailActionModel];
// Json 응답에서 게시물 목록 파싱 후 `_boardList`에 추가.
for (Map<String, dynamic> boardJson in response) {
try {
BoardDetailActionModel boardDetail =
BoardDetailActionModel.fromJson(boardJson);
if (boardDetail.user_writable) {
_boardList.add(boardDetail);
}
} catch (error) {
debugPrint(
"refreshBoardList BoardDetailActionModel.fromJson 실패: $error");
return;
}
}
});
}
위 코드로만 전달하셔도 무방합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기능은 정상 동작합니다! 없어도 되는 코드 수정 요청 드렸어요
updateStateWithCachedOrFetchedApiData 함수에서 이미 구현된 (getApiRes) DioException Handling 제거
mistake fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
updateStateWithCachedOrFetchedApiData 함수를 사용해 게시판 목록 caching 기능 추가.
Overview
게시물 작성 페이지에서 게시판 목록 캐싱 기능 추가.
Changes
Implementaion Method
After Changes
Related Issues
Rollback Scenario
TODO