chore: Implement better Price abstraction for Digital Ocean server provider

pull/213/head
NaiJi ✨ 2023-06-07 00:11:36 -03:00
parent 49fe40bb38
commit fa4939d7c6
2 changed files with 7 additions and 4 deletions

View File

@ -27,7 +27,7 @@ class ApiProviderVolumeCubit
}
Future<Price?> getPricePerGb() async =>
ProvidersController.currentServerProvider!.getPricePerGb();
(await ProvidersController.currentServerProvider!.getPricePerGb()).data;
Future<void> refresh() async {
emit(const ApiProviderVolumeState([], LoadingStatus.refreshing, false));

View File

@ -779,9 +779,12 @@ class DigitalOceanServerProvider extends ServerProvider {
/// Hardcoded on their documentation and there is no pricing API at all
/// Probably we should scrap the doc page manually
@override
Future<Price?> getPricePerGb() async => Price(
value: 0.10,
currency: 'USD',
Future<GenericResult<Price?>> getPricePerGb() async => GenericResult(
success: true,
data: Price(
value: 0.10,
currency: 'USD',
),
);
@override