- Upgrade flutter_riverpod to 3.1.0, riverpod_annotation to 4.0.0 - Upgrade freezed to 3.2.3, freezed_annotation to 3.1.0 - Migrate freezed classes to use sealed keyword (freezed 3.x) - Update provider naming (*NotifierProvider → *Provider) - Add legacy.dart import for StateNotifierProvider compatibility - Fix valueOrNull → value for AsyncValue - Remove unused imports and fields - Add sync from Authentik button to users/groups pages - Suppress invalid_annotation_target warning in analysis_options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
55 lines
1.3 KiB
Dart
55 lines
1.3 KiB
Dart
import 'package:dio/dio.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
import 'package:tatlock_ui/core/api/api_interceptors.dart';
|
|
import 'package:tatlock_ui/core/config/app_config.dart';
|
|
|
|
part 'api_client.g.dart';
|
|
|
|
/// Provides the Dio instance for Core API.
|
|
@riverpod
|
|
Dio coreApiClient(Ref ref) {
|
|
final dio = Dio(
|
|
BaseOptions(
|
|
baseUrl: AppConfig.coreApiUrl,
|
|
connectTimeout: const Duration(seconds: 10),
|
|
receiveTimeout: const Duration(seconds: 30),
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Accept': 'application/json',
|
|
},
|
|
),
|
|
);
|
|
|
|
dio.interceptors.addAll([
|
|
AuthInterceptor(ref),
|
|
LoggingInterceptor(),
|
|
ErrorInterceptor(),
|
|
]);
|
|
|
|
return dio;
|
|
}
|
|
|
|
/// Provides the Dio instance for Tatlock API.
|
|
@riverpod
|
|
Dio tatlockApiClient(Ref ref) {
|
|
final dio = Dio(
|
|
BaseOptions(
|
|
baseUrl: AppConfig.tatlockApiUrl,
|
|
connectTimeout: const Duration(seconds: 10),
|
|
receiveTimeout: const Duration(minutes: 5), // Longer for LLM responses
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Accept': 'application/json',
|
|
},
|
|
),
|
|
);
|
|
|
|
dio.interceptors.addAll([
|
|
AuthInterceptor(ref),
|
|
LoggingInterceptor(),
|
|
ErrorInterceptor(),
|
|
]);
|
|
|
|
return dio;
|
|
}
|