Fix local dev config and ALOTTTT OFF FLUTTER, im tired boss..
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
|
||||
import '../../../../core/errors/failures.dart';
|
||||
import '../../../../core/network/api_client.dart';
|
||||
import '../../domain/repositories/sos_repository.dart';
|
||||
|
||||
class SosRepositoryImpl implements SosRepository {
|
||||
final ApiClient _apiClient;
|
||||
|
||||
const SosRepositoryImpl(this._apiClient);
|
||||
|
||||
@override
|
||||
Future<Either<Failure, void>> triggerSos({
|
||||
required String triggerType,
|
||||
double? lat,
|
||||
double? lng,
|
||||
}) async {
|
||||
try {
|
||||
await _apiClient.dio.post('/user/sos', data: {
|
||||
'triggerType': triggerType,
|
||||
'lat': lat,
|
||||
'lng': lng,
|
||||
});
|
||||
return const Right(null);
|
||||
} catch (_) {
|
||||
return const Left(NetworkFailure('SOS belum terkirim. Coba lagi.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user