19 lines
635 B
Dart
19 lines
635 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:initial_folder/base_service.dart';
|
|
import 'package:initial_folder/models/section_lesson_model.dart';
|
|
import 'package:http/http.dart' as http;
|
|
|
|
class SectionLessonService {
|
|
Future<SectionLessonModel> getSectionLessonCourse(String id) async {
|
|
Uri url = Uri.parse('$baseUrl/homepage/section/$id');
|
|
http.Response response = await http.get(url, headers: baseHeader);
|
|
print(response.statusCode);
|
|
if (response.statusCode == 200) {
|
|
return SectionLessonModel.fromJson(jsonDecode(response.body));
|
|
} else {
|
|
throw Exception('Data Detail Kursus Gagal Diambil');
|
|
}
|
|
}
|
|
}
|