updateSession function

Future<void> updateSession(
  1. String sessionId,
  2. String status
)

Implementation

Future<void> updateSession(String sessionId, String status) async {
  try {
    final response =
        await http.post(Uri.parse('$BACKEND_BASE_URL/api/sdk/update-session/'),
            headers: {'Content-Type': 'application/json'},
            body: jsonEncode({
              'sessionId': sessionId,
              'status': status,
            }));
    if (response.statusCode != 200) {
      throw Exception('Error updating session with sessionId: $sessionId');
    }
    final res = json.decode(response.body);
    return res;
  } catch (err) {
    rethrow;
  }
}