getStudentWarningList method

dynamic getStudentWarningList(
  1. int studentUid
)

Implementation

getStudentWarningList(int studentUid) async {
  try {
    Response response = await _dio.get(
      "$apiUrl/dalgeurak/warning/$studentUid",
      options: Options(contentType: "application/json"),
    );

    List originalData = response.data['warning'];
    List formattingData = [];
    originalData.forEach((element) => formattingData.add(DalgeurakWarning.fromJson(element)));

    return {
      "success": true,
      "content": formattingData,
    };
  } on DioError catch (e) {
    return {
      "success": false,
      "content": e.response?.data["message"]
    };
  }
}