feat: rebuild app with pocketbase sdk instead of dio
This commit is contained in:
parent
09ee89d928
commit
b58b7ca57a
9 changed files with 531 additions and 381 deletions
|
|
@ -5,6 +5,8 @@ import 'package:flutter/services.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'src/app.dart';
|
||||
import 'src/shared/data/local/app_database.dart';
|
||||
import 'src/shared/data/remote/api_client.dart';
|
||||
import 'src/shared/data/remote/pb_auth_store.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
void main() async {
|
||||
|
|
@ -26,9 +28,25 @@ void main() async {
|
|||
|
||||
final database = AppDatabase();
|
||||
|
||||
final authStore = PbAuthStore();
|
||||
await authStore.loadFromStorage();
|
||||
|
||||
if (authStore.isValid && authStore.record == null) {
|
||||
final tempClient = ApiClient(authStore: authStore);
|
||||
try {
|
||||
await tempClient.refreshAuth();
|
||||
} catch (e) {
|
||||
log('Initial auth refresh failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
runApp(
|
||||
ProviderScope(
|
||||
overrides: [appDatabaseProvider.overrideWithValue(database)],
|
||||
overrides: [
|
||||
appDatabaseProvider.overrideWithValue(database),
|
||||
apiClientProvider
|
||||
.overrideWith((ref) => ApiClient(authStore: authStore)),
|
||||
],
|
||||
child: const SLRPGApp(),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue