getSelfInfo method

Future<TCICSelfInfoModel?> getSelfInfo()

Implementation

Future<TCICSelfInfoModel?> getSelfInfo() async {
  final selfUserInfo = _membersInfoObs.selfUserInfo.value;
  if (selfUserInfo.userId.isNotEmpty) {
    return selfUserInfo;
  }
  final res = await networkService.getSelfInfo();
  if (res?.errorCode == 0) {
    TCICLog.info('getSelfInfo success', actionModule: ActionModule.tcicController.name, actionName: ActionName.getSelfInfo.name);
    if(res != null){
      if(res.userInfo.userId.isNotEmpty){
        _membersInfoObs.updateSelfUserInfo(res.userInfo);
        return res.userInfo;
      }
    } else {
      TCICLog.error('getSelfInfo failed userInfo is null', actionModule: ActionModule.tcicController.name, actionName: ActionName.getSelfInfo.name);
      return null;
    }
  } else {
    TCICLog.error('getSelfInfo failed errorCode: ${res?.errorCode}', actionModule: ActionModule.tcicController.name, actionName: ActionName.getSelfInfo.name);
    return null;
  }
  return null;
}