feat(feed): Comment creation API and state update

This commit is contained in:
2024-05-21 16:04:00 +03:00
parent 35bafdc701
commit 6ad23e240f
3 changed files with 25 additions and 21 deletions

View File

@@ -34,6 +34,9 @@ class FeedBloc extends Bloc<FeedEvent, FeedState> {
}
final response = await http.get(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/feed/index'),
headers: {
'Authorization': 'Bearer $token',
},
);
print('Got response');
if (response.statusCode == 200) {

View File

@@ -118,7 +118,6 @@ class FeedScreen extends StatelessWidget {
itemCount: state.posts?.length ?? 0,
itemBuilder: (context, index) {
final post = state.posts?[index];
print(post['author']['name']);
return Container(
margin: EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
@@ -161,7 +160,7 @@ class FeedScreen extends StatelessWidget {
onTap: () => Navigator.pushNamed(
context,
AppRoutes.blogPostScreen,
arguments: post?['id'].toString(),
arguments: post?['post']['id'].toString(),
),
trailing: PopupMenuButton<String>(
onSelected: (value) => print("tap"),