Initial commit: Penyerahan final Source code Tugas Akhir
This commit is contained in:
18
lib/services/instructor_service.dart
Normal file
18
lib/services/instructor_service.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:initial_folder/base_service.dart';
|
||||
import 'package:initial_folder/models/instructor_model.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class InstructorService {
|
||||
Future<InstructorModel> getInstructorProfile(id) async {
|
||||
Uri url = Uri.parse('$baseUrl/homepage/course/detail/instructor/$id');
|
||||
http.Response response = await http.get(url, headers: baseHeader);
|
||||
print('instructor' + response.body);
|
||||
if (response.statusCode == 200) {
|
||||
return InstructorModel.fromJson(jsonDecode(response.body));
|
||||
} else {
|
||||
throw Exception('Data Profile Instruktur Gagal Diambil');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user