From 9b1e4232104e141a3436c3a83cff0c8af025e8ec Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Thu, 20 Oct 2022 11:34:22 +0200 Subject: [PATCH] Add Request to get lists --- app/Mailman/Actions/SettingIndexAction.php | 2 +- app/Mailman/Support/MailmanService.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Mailman/Actions/SettingIndexAction.php b/app/Mailman/Actions/SettingIndexAction.php index ae8cacf3..e1dd093d 100644 --- a/app/Mailman/Actions/SettingIndexAction.php +++ b/app/Mailman/Actions/SettingIndexAction.php @@ -31,7 +31,7 @@ class SettingIndexAction session()->put('title', 'Mailman-Einstellungen'); $state = $settings->base_url && $settings->username && $settings->password && $settings->is_active - ? app(MailmanService::class)->setCredentials($settings->base_url, $settings->username, $settings->password)->check() + ? app(MailmanService::class)->fromSettings($settings)->check() : null; return Inertia::render('setting/Mailman', [ diff --git a/app/Mailman/Support/MailmanService.php b/app/Mailman/Support/MailmanService.php index 1787e5f1..fdfdaba0 100644 --- a/app/Mailman/Support/MailmanService.php +++ b/app/Mailman/Support/MailmanService.php @@ -4,6 +4,7 @@ namespace App\Mailman\Support; use App\Mailman\Data\MailingList; use App\Mailman\Exceptions\MailmanServiceException; +use App\Mailman\MailmanSettings; use Illuminate\Http\Client\ConnectionException; use Illuminate\Http\Client\PendingRequest; use Illuminate\Support\Facades\Http; @@ -25,6 +26,11 @@ class MailmanService return $this; } + public function fromSettings(MailmanSettings $settings): self + { + return $this->setCredentials($settings->base_url, $settings->username, $settings->password); + } + public function check(): bool { try {