first commit
This commit is contained in:
42
lib/domain/repository/authentication/auth_repository.dart
Normal file
42
lib/domain/repository/authentication/auth_repository.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../../../constants/api_constants.dart';
|
||||
import '../../../data/authentication/auth_request.dart';
|
||||
import '../../../data/authentication/auth_response.dart';
|
||||
import '../../../modules/authentication/auth.dart';
|
||||
import '../../../modules/authentication/getbyid.dart';
|
||||
import '../../provider/authentication/auth_provider.dart';
|
||||
|
||||
|
||||
class LoginRepository{
|
||||
|
||||
LoginProvider loginProvider = LoginProvider();
|
||||
final LoginProvider _profileProvider = LoginProvider();
|
||||
|
||||
Future<LoginResponse?> signIn(LoginRequest data) async {
|
||||
|
||||
return await loginProvider.signIn('${ApiConstants.login}',data);
|
||||
|
||||
}
|
||||
Future<CustomerFullView?> fetchProfile(String customerId) async {
|
||||
return await _profileProvider.getProfile(customerId);
|
||||
}
|
||||
|
||||
|
||||
Future<dynamic> updateProfile(dynamic data) async {
|
||||
final String url = ApiConstants.updateCustomer;
|
||||
try {
|
||||
final dio = Dio();
|
||||
// print(url);
|
||||
final response = await dio.put(url, data: data);
|
||||
|
||||
return response.data;
|
||||
|
||||
} catch (e) {
|
||||
print("Error updating profile: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
21
lib/domain/repository/authentication/location_repo.dart
Normal file
21
lib/domain/repository/authentication/location_repo.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import '../../../modules/authentication/auth.dart';
|
||||
|
||||
abstract class CustomerLocationRepository {
|
||||
Future<List<Authentication>> fetchCustomerLocations(int customerId);
|
||||
|
||||
Future<bool> createCustomerLocation({
|
||||
required int customerId,
|
||||
required String address,
|
||||
required String doorNo,
|
||||
required String landmark,
|
||||
String suburb,
|
||||
String city,
|
||||
String state,
|
||||
String postcode,
|
||||
String latitude,
|
||||
String longitude,
|
||||
String defaultAddress,
|
||||
int primaryAddress,
|
||||
int status,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user