errorMessage = null; if (blank($this->search)) { $this->errorMessage = 'Le champ de recherche (search) est obligatoire.'; return; } $this->hasSearched = true; try { $service = app(LogisticsService::class); $params = array_filter([ 'select' => $this->select, 'results' => $this->results, 'search' => $this->search, ]); $response = $service->thirdList($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 = []; } } public function getArtHistory(): void { $this->errorMessage = null; if (blank($this->historyThirdId)) { $this->errorMessage = 'Le champ identifiant tiers (thirdid) est obligatoire.'; return; } $this->hasHistory = true; try { $service = app(LogisticsService::class); $response = $service->thirdGetArtHistory($this->historyThirdId); $this->historyData = $response['data'] ?? []; $this->errorMessage = ApiErrorTranslator::translate($response['error'] ?? null); } catch (LogisticsApiException $e) { $this->errorMessage = ApiErrorTranslator::translate($e->getMessage()); $this->historyData = []; } catch (\Throwable $e) { $this->errorMessage = ApiErrorTranslator::translate($e->getMessage()); $this->historyData = []; } } }