23 lines
726 B
Dart
23 lines
726 B
Dart
import '../../storage/dev_tools_settings.dart';
|
|
|
|
/// Singleton holding the currently active Marianum-Connect base URL. Fed by a
|
|
/// SettingsCubit listener in app.dart so every dio call picks up endpoint
|
|
/// changes without holding a reference to the cubit.
|
|
class MarianumConnectEndpoint {
|
|
static String _baseUrl = DevToolsSettings.liveUrl;
|
|
|
|
static String current() => _baseUrl;
|
|
|
|
static void update(String baseUrl) {
|
|
_baseUrl = baseUrl;
|
|
}
|
|
|
|
/// Joins the base URL with the mobile API prefix and the given path.
|
|
static String resolve(String relativePath) {
|
|
final path = relativePath.startsWith('/')
|
|
? relativePath.substring(1)
|
|
: relativePath;
|
|
return '$_baseUrl/api/mobile/v1/$path';
|
|
}
|
|
}
|