touchPruefer method

RequestAndParser<Response, TouchPrueferResult> touchPruefer(
  1. int pjNr
)

updates the pruefer-id for a project to the currently logged-in user, but only if it differs.

Implementation

RequestAndParser<http.Response, TouchPrueferResult> touchPruefer(int pjNr) {
  final rd = RequestData(
    _touchPruefer_r,
    json: {'PjNr': pjNr},
  );

  parser(http.Response res) {
    try {
      final decoded = jsonDecode(res.body);
      return TouchPrueferResult.fromJson(decoded);
    } catch (_) {
      return TouchPrueferResult(
        updated: false,
        oldLoginIdPruefer: null,
        loginIdPruefer: null,
      );
    }
  }

  return RequestAndParser(rd: rd, parser: parser);
}