fix: service status indicator + oauth saving

This commit is contained in:
Andras Bacsai
2024-12-13 12:03:05 +01:00
parent 2a77d9d8ce
commit 4901b12279
11 changed files with 47 additions and 36 deletions

View File

@@ -35,16 +35,26 @@ class SettingsOauth extends Component
}, []);
}
private function updateOauthSettings()
private function updateOauthSettings(?string $provider = null)
{
foreach (array_values($this->oauth_settings_map) as &$setting) {
$setting->save();
if ($provider) {
$oauth = $this->oauth_settings_map[$provider];
if (! $oauth->couldBeEnabled()) {
$oauth->update(['enabled' => false]);
throw new \Exception('OAuth settings are not complete for '.$oauth->provider.'.<br/>Please fill in all required fields.');
}
$oauth->save();
$this->dispatch('success', 'OAuth settings for '.$oauth->provider.' updated successfully!');
}
}
public function instantSave()
public function instantSave(string $provider)
{
$this->updateOauthSettings();
try {
$this->updateOauthSettings($provider);
} catch (\Exception $e) {
return handleError($e, $this);
}
}
public function submit()