修改设备别名接口+UI
This commit is contained in:
@@ -61,6 +61,19 @@ class DeviceRepositoryImpl implements DeviceRepository {
|
||||
return Left(DeviceFailure(cleanMessage));
|
||||
}
|
||||
}
|
||||
@override
|
||||
Future<Either<DeviceFailure, int>> updateDeviceName(String deviceId, String deviceName) async {
|
||||
try {
|
||||
var result = await _deviceHttpDatasource.updateDeviceName(deviceId, deviceName);
|
||||
return Right(result);
|
||||
} on DioException catch (e) {
|
||||
final String serverMessage = e.response?.data['msg'] ?? "网络连接异常";
|
||||
return Left(DeviceFailure(serverMessage));
|
||||
} catch (e) {
|
||||
final cleanMessage = e.toString().replaceFirst('Exception: ', '');
|
||||
return Left(DeviceFailure(cleanMessage));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<DeviceFailure, int>> switchDevice(
|
||||
|
||||
Reference in New Issue
Block a user