import 'package:zhiying_comm/zhiying_comm.dart';

class CustomPageRepository {
  Map<String, dynamic> data;

  CustomPageRepository({this.data});

  /// 初始化
  Future<List<Map<String, dynamic>>> fetchInitData() async {
    try {
      String skipIdentifier = !EmptyUtil.isEmpty(data) && data.containsKey(GlobalConfig.SKIP_IDENTIFIER) && !EmptyUtil.isEmpty(data[GlobalConfig.SKIP_IDENTIFIER])
          ? data[GlobalConfig.SKIP_IDENTIFIER]
          : null;
      if (!EmptyUtil.isEmpty(skipIdentifier)) {
        var result = await NetUtil.post('/api/v1/mod/$skipIdentifier', method: NetMethod.GET);
        if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) {}
      }
    } catch (e, s) {
      Logger.error(e, s);
    }
    return null;
  }

  /// 缓存数据
  Future<List<Map<String, dynamic>>> fetchCacheData() async {
    try {} catch (e, s) {
      Logger.error(e, s);
    }
    return null;
  }
}
