createCalibrateArticle<A extends ArticleRawAbstract> method

  1. @action
Future<CalibreWeebi<ArticleRawAbstract>> createCalibrateArticle<A extends ArticleRawAbstract>(
  1. CalibreWeebi<A> data
)

if gatekeeperIsLinked then connectivity was already checked in the view if sending data goes wrong we do not persist in queue but stop the action

Implementation

@action
Future<CalibreWeebi> createCalibrateArticle<A extends ArticleRawAbstract>(
    CalibreWeebi<A> data) async {
  await _createCalibreServer(data);

  final calibre = await _articlesService.createCalibreRpc.request(data);
  calibresFull.add(calibre);
  _calibres.add(calibre);
  if (A is ArticleUncountable) {
    return CalibreWeebi.fromMapArticleUncountable(
        calibre.toMap(isProto: false));
  } else if (A is ArticleRetail) {
    return CalibreWeebi.fromMapArticleRetail(calibre.toMap(isProto: false));
  }
  return calibre;
}