read method

Future<void> read()

Implementation

Future<void> read() async {
  state.loading();
  await UServices.user.readById(
    p: UIdParams(
      id: user.id,
      selectorArgs: const UserSelectorArgs(wallet: WalletSelectorArgs(), merchant: MerchantSelectorArgs()),
    ),
    onOk: (UResponse<UUserResponse> r) {
      if (r.result != null) user = r.result!;
    },
    onError: (UEmptyResponse r) {},
    onException: (String e) {},
    onProgress: (int e) {},
  );
  await UServices.hotel.readDormBedContract(
    p: UDormBedContractReadParams(
      userId: user.id,
      pageNumber: 1,
      pageSize: 100,
      selectorArgs: const ContractSelectorArgs(
        bed: DormBedSelectorArgs(room: DormRoomSelectorArgs(dorm: DormSelectorArgs())),
        invoice: InvoiceSelectorArgs(),
      ),
    ),
    onOk: (UResponse<List<UDormBedContractResponse>> r) {
      contracts.value = r.result ?? <UDormBedContractResponse>[];
      state.loaded();
    },
    onError: (UResponse<dynamic> e) => state.error(),
    onException: (String e) => state.error(),
  );
}