import 'dart:async';

import '../../network/NetworkConfig.dart';
import '../../network/RequestCenter.dart';

class SetModel {
  StreamController streamController = StreamController.broadcast();

  ///修改密码
  Future<void> updateUserPwd(oldPassword, newPassword) async {
    RequestCenter.instance.request(NetworkConfig.updateUserPwd, {
      "oldPassword": oldPassword,
      "newPassword": newPassword,
    }, (dataEntity) {
      switch (dataEntity.code) {
        case 200:
          streamController.sink.add({
            'code': "updateUserPwd", //有数据
            'data': dataEntity.msg,
          });
          break;

        case 110:
          streamController.sink.add({
            'code': "updateUserPwdError", //有数据
            'data': dataEntity.msg,
          });
          break;
      }
    }, (errorEntity) {
      print("errorEntity==${errorEntity.msg}");
    });
  }
}
