-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from 4Ailen/feat/#123_marketAPI
Feat/#123 market api
- Loading branch information
Showing
9 changed files
with
177 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import 'package:aliens/mockdatas/board_mockdata.dart'; | ||
import 'package:aliens/models/board_model.dart'; | ||
import 'package:aliens/models/market_articles.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
import '../apis/apis.dart'; | ||
import '../models/comment_model.dart'; | ||
import '../models/market_comment.dart'; | ||
|
||
class BookmarksProvider with ChangeNotifier { | ||
List<MarketBoard>? articleList; | ||
bool loading = false; | ||
List<MarketBoard>? bookmarksList; | ||
List<int>? marketArticleBookmarkCount; | ||
|
||
|
||
addBookmarks(int articleId, int index) async { | ||
loading = true; | ||
try { | ||
//좋아요 요청 | ||
print('이건되나'); | ||
marketArticleBookmarkCount![index] = await APIs.marketbookmark(articleId); | ||
print('이건???'); | ||
|
||
} catch (e) { | ||
if (e == "AT-C-002") { | ||
await APIs.getAccessToken(); | ||
//좋아요 요청 | ||
marketArticleBookmarkCount![index] = await APIs.marketbookmark(articleId); | ||
|
||
} else { | ||
} | ||
} | ||
loading = false; | ||
notifyListeners(); | ||
getbookmarksCounts(); | ||
print('이것도 될라나;;'); | ||
} | ||
|
||
getbookmarksCounts() async { | ||
articleList = await APIs.getMarketArticles(); | ||
marketArticleBookmarkCount = articleList!.map((marketboard) => marketboard.marketArticleBookmarkCount ?? 0).toList(); | ||
//print(marketboard.marketArticleBookmarkCount ?? 0); | ||
// print('북마크개수:${marketArticleBookmarkCount}'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.