Initial commit: Penyerahan final Source code Tugas Akhir

This commit is contained in:
ferdiakhh
2025-07-10 19:15:14 +07:00
commit e1f2206b8a
687 changed files with 80132 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import 'dart:convert';
import 'package:initial_folder/base_service.dart';
import 'package:initial_folder/helper/user_info.dart';
import 'package:initial_folder/models/lesson_model.dart';
import 'package:http/http.dart' as http;
class CurrentLessonService {
Future<LessonModel> getCurrentLesson(String lessonId) async {
String? token = await UsersInfo().getToken();
print(
"Ini Current Lesson ID ----------------------------------> : $lessonId");
Uri url = Uri.parse('$baseUrl/users/course/my/lesson/$lessonId');
http.Response response =
await http.get(url, headers: headerWithToken(token!));
print("Ini Current Lesson ------------------------> : ${response.body}");
if (response.statusCode == 200) {
return LessonModel.fromJson(jsonDecode(response.body)["data"][0]);
} else {
throw Exception('Data Lesson Gagal Diambil');
}
}
}