send page qr code

This commit is contained in:
2024-02-18 16:23:10 +01:00
parent 463e7ee287
commit 1286a5d848
15 changed files with 300 additions and 39 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simplecloudnotifier/api/api_client.dart';
import '../models/key_token_auth.dart';
import '../models/user.dart';
@@ -60,4 +61,22 @@ class UserAccount extends ChangeNotifier {
await prefs.setString('auth.token', _auth!.token);
}
}
loadUser(bool force) async {
if (!force && _user != null) {
return _user;
}
if (_auth == null) {
throw Exception('Not authenticated');
}
final user = await APIClient.getUser(_auth!.userId, _auth!.token);
setUser(user);
await save();
return user;
}
}