import 'package:dart_json_mapper/dart_json_mapper.dart';
import 'package:get/get.dart';
import 'package:naiyouwl/app/data/model/SysConfig.dart';
import 'package:naiyouwl/app/data/model/LocalUser.dart';
import 'package:naiyouwl/app/common/SharedPreferencesUtil.dart';

class LocalStorageService extends GetxController {
  Future<SysConfig?> fetchSysConfig() async {
    String? data = await SharedPreferencesUtil().getString("sysconfig");
    if (data != null) {
      return JsonMapper.deserialize<SysConfig>(data);
    }
    return null;
  }

  Future<LocalUser?> fetchLocalUser() async {
    String? userdata = await SharedPreferencesUtil().getString("localUser");
    if (userdata != null) {
      return JsonMapper.deserialize<LocalUser>(userdata);
    }
    return null;
  }
}