fix: add missing changes
This commit is contained in:
parent
6b70116a63
commit
c290c268e8
1 changed files with 0 additions and 61 deletions
|
|
@ -1,60 +1,3 @@
|
||||||
// import 'dart:convert';
|
|
||||||
// import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
||||||
// import 'package:pocketbase/pocketbase.dart';
|
|
||||||
|
|
||||||
// class PbAuthStore extends AuthStore {
|
|
||||||
// final FlutterSecureStorage _storage;
|
|
||||||
// final String _storageKey;
|
|
||||||
|
|
||||||
// PbAuthStore({
|
|
||||||
// FlutterSecureStorage? storage,
|
|
||||||
// String key = 'pb_auth',
|
|
||||||
// }) : _storage = storage ?? const FlutterSecureStorage(),
|
|
||||||
// _storageKey = key,
|
|
||||||
// super();
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Future<void> save(String newToken, dynamic newRecord) async {
|
|
||||||
// super.save(newToken, newRecord);
|
|
||||||
|
|
||||||
// final encoded = jsonEncode(<String, dynamic>{
|
|
||||||
// 'token': newToken,
|
|
||||||
// 'model': newRecord,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// await _storage.write(key: _storageKey, value: encoded);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// void clear() {
|
|
||||||
// super.clear();
|
|
||||||
// _storage.delete(key: _storageKey);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Future<void> loadFromStorage() async {
|
|
||||||
// final raw = await _storage.read(key: _storageKey);
|
|
||||||
// if (raw != null && raw.isNotEmpty) {
|
|
||||||
// try {
|
|
||||||
// final decoded = jsonDecode(raw) as Map<String, dynamic>;
|
|
||||||
// final token = decoded['token'] as String?;
|
|
||||||
// final model = decoded['model'];
|
|
||||||
|
|
||||||
// if (token != null && token.isNotEmpty) {
|
|
||||||
// super.save(token, model);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// } catch (_) {
|
|
||||||
// clear();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const legacyKey = 'auth_token';
|
|
||||||
// final legacyToken = await _storage.read(key: legacyKey);
|
|
||||||
// if (legacyToken != null && legacyToken.isNotEmpty) {
|
|
||||||
// super.save(legacyToken, null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:pocketbase/pocketbase.dart';
|
import 'package:pocketbase/pocketbase.dart';
|
||||||
|
|
@ -87,7 +30,6 @@ class PbAuthStore extends AuthStore {
|
||||||
await _storage.delete(key: _saveKey);
|
await _storage.delete(key: _saveKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Diese Methode rufen wir VOR App-Start auf!
|
|
||||||
Future<void> loadFromStorage() async {
|
Future<void> loadFromStorage() async {
|
||||||
final raw = await _storage.read(key: _saveKey);
|
final raw = await _storage.read(key: _saveKey);
|
||||||
if (raw != null && raw.isNotEmpty) {
|
if (raw != null && raw.isNotEmpty) {
|
||||||
|
|
@ -106,11 +48,8 @@ class PbAuthStore extends AuthStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// super.save schreibt nur in den Speicher (RAM) des AuthStores,
|
|
||||||
// löst aber kein erneutes 'save' (und damit write) aus.
|
|
||||||
super.save(token, model);
|
super.save(token, model);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Daten korrupt? Löschen.
|
|
||||||
await clear();
|
await clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue