feat: refactor code
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../../../../../core/locator/locator.dart';
|
||||
import '../../../../../core/network/api_provider_imp.dart';
|
||||
|
||||
class ShopApiProvider {
|
||||
ApiProviderImp get _api => locator<ApiProviderImp>();
|
||||
|
||||
Future<Response> getShop() => _api.get('/shop');
|
||||
|
||||
Future<Response> buyCard(String cardId) =>
|
||||
_api.post('/shop/buy-card', body: {'card_id': cardId});
|
||||
|
||||
Future<Response> selectCard(String cardId) =>
|
||||
_api.post('/shop/select-card', body: {'card_id': cardId});
|
||||
|
||||
Future<Response> purchase({
|
||||
required String store,
|
||||
required String kind,
|
||||
required String productId,
|
||||
required String token,
|
||||
}) =>
|
||||
_api.post('/shop/purchase', body: {
|
||||
'store': store,
|
||||
'kind': kind,
|
||||
'product_id': productId,
|
||||
'token': token,
|
||||
});
|
||||
|
||||
Future<Response> adReward(String token) =>
|
||||
_api.post('/rewards/ad', body: {'token': token});
|
||||
}
|
||||
Reference in New Issue
Block a user