forked from eatvio/eatvio_app
Data transfer and state control
This commit is contained in:
@@ -27,16 +27,16 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
|
||||
AppRoutes.authScreen,
|
||||
);
|
||||
}
|
||||
final int id = 1;
|
||||
final String? id = state.chatModelObj?.chatID;
|
||||
final response = await http.get(
|
||||
Uri.parse(dotenv.env['SERVER_ROOT']! + '/chat/$id/show'),
|
||||
Uri.parse(dotenv.env['SERVER_ROOT']! + '/chat/show/$id'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body);
|
||||
print(data['chatRooms']);
|
||||
print(data);
|
||||
if (data is Map<String, dynamic> && data.containsKey('chatRooms')) {
|
||||
if (state is ChatLoadedState) {
|
||||
var currentState = state as ChatLoadedState;
|
||||
|
||||
Reference in New Issue
Block a user