fix: service status indicator + oauth saving
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user