Initial commit: Penyerahan final Source code Tugas Akhir
This commit is contained in:
22
lib/services/forgot_password_service.dart
Normal file
22
lib/services/forgot_password_service.dart
Normal file
@ -0,0 +1,22 @@
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../base_service.dart';
|
||||
import '../models/forgot_password_model.dart';
|
||||
|
||||
class ForgotService {
|
||||
Future<ForgotPasswordModel> forgotPassword({
|
||||
required String email,
|
||||
}) async {
|
||||
Uri url = Uri.parse('$baseUrl/auth/mobile/forgot-password');
|
||||
var body = jsonEncode({
|
||||
'email': email,
|
||||
});
|
||||
|
||||
var response = await http.post(url, headers: baseHeader, body: body);
|
||||
if (response.statusCode == 200) {
|
||||
return ForgotPasswordModel.fromJson(jsonDecode(response.body)['data']);
|
||||
} else {
|
||||
throw response.body;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user