errorMessage = null; if (blank($this->type)) { $this->errorMessage = 'Le champ type de journal (TYPE) est obligatoire.'; return; } $this->hasSearched = true; try { $service = app(LogisticsService::class); $params = array_filter([ 'select' => $this->select, 'results' => (string) $this->results, 'TYPE' => $this->type, ]); $response = $service->jnlList($params); $this->data = $response['data'] ?? []; $this->metadata = $response['metadata'] ?? null; $this->errorMessage = ApiErrorTranslator::translate($response['error'] ?? null); } catch (LogisticsApiException $e) { $this->errorMessage = ApiErrorTranslator::translate($e->getMessage()); $this->data = []; } catch (\Throwable $e) { $this->errorMessage = ApiErrorTranslator::translate($e->getMessage()); $this->data = []; } } }