diff --git a/frontend/lib/settings/settings.dart b/frontend/lib/settings/settings.dart index 1868c6c..ae85215 100644 --- a/frontend/lib/settings/settings.dart +++ b/frontend/lib/settings/settings.dart @@ -71,6 +71,7 @@ class _SettingsState extends State { if (!_formKey.currentState!.validate()) return; PrefUtil.setValue('base_url', _baseUrlController.text); PrefUtil.setValue('api_key', XOR().xorEncode(_apiKeyController.text)); + BackendAPI.instance.reconfigureFromPrefs(); context.read().setTheme(_selectedTheme); UISnackbars.showSuccess(context, 'Settings saved successfully'); } diff --git a/frontend/lib/utils/oott_api.dart b/frontend/lib/utils/oott_api.dart index c116cb8..ddd0773 100644 --- a/frontend/lib/utils/oott_api.dart +++ b/frontend/lib/utils/oott_api.dart @@ -57,6 +57,10 @@ class BackendAPI { static BackendAPI get instance => _instance; BackendAPI._internal() { + reconfigureFromPrefs(); + } + + void reconfigureFromPrefs() { _baseUrl = PrefUtil.getValue("base_url", "http://localhost:3000/api") as String; _apiKey = XOR().xorDecode(PrefUtil.getValue("api_key", "") as String);