@@ -4,7 +4,6 @@ namespace App\Livewire\Storage;
|
||||
|
||||
use App\Models\S3Storage;
|
||||
use Livewire\Component;
|
||||
use Throwable;
|
||||
|
||||
class Create extends Component
|
||||
{
|
||||
@@ -69,17 +68,19 @@ class Create extends Component
|
||||
$this->storage->key = $this->key;
|
||||
$this->storage->secret = $this->secret;
|
||||
$this->storage->bucket = $this->bucket;
|
||||
$this->storage->endpoint = ! isset($this->endpoint) || ($this->endpoint === '' || $this->endpoint === '0') ? "https://s3.{$this->region}.amazonaws.com" : $this->endpoint;
|
||||
if (empty($this->endpoint)) {
|
||||
$this->storage->endpoint = "https://s3.{$this->region}.amazonaws.com";
|
||||
} else {
|
||||
$this->storage->endpoint = $this->endpoint;
|
||||
}
|
||||
$this->storage->team_id = currentTeam()->id;
|
||||
$this->storage->testConnection();
|
||||
$this->storage->save();
|
||||
|
||||
return redirect()->route('storage.show', $this->storage->uuid);
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
$this->dispatch('error', 'Failed to create storage.', $e->getMessage());
|
||||
// return handleError($e, $this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace App\Livewire\Storage;
|
||||
|
||||
use App\Models\S3Storage;
|
||||
use Livewire\Component;
|
||||
use Throwable;
|
||||
|
||||
class Form extends Component
|
||||
{
|
||||
@@ -38,11 +37,9 @@ class Form extends Component
|
||||
$this->storage->testConnection(shouldSave: true);
|
||||
|
||||
return $this->dispatch('success', 'Connection is working.', 'Tested with "ListObjectsV2" action.');
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
$this->dispatch('error', 'Failed to create storage.', $e->getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
@@ -51,7 +48,7 @@ class Form extends Component
|
||||
$this->storage->delete();
|
||||
|
||||
return redirect()->route('storage.index');
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
@@ -61,10 +58,8 @@ class Form extends Component
|
||||
$this->validate();
|
||||
try {
|
||||
$this->test_s3_connection();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use Livewire\Component;
|
||||
|
||||
class Show extends Component
|
||||
{
|
||||
public $storage;
|
||||
public $storage = null;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user