Clé d'API rendue au client reconstruit au démarrage

La clé est persistée en base locale, mais le client était reconstruit sans elle :
tous les appels suivants partaient anonymes, à commencer par celui qui rapporte la
configuration à afficher.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thomas Fransolet 2026-09-15 17:33:21 +02:00
parent 6efd67611f
commit 9e213968f5

View File

@ -35,7 +35,11 @@ void main() async {
if(localContext != null && localContext.host != null) {
print("we've got an local db !");
print(localContext);
localContext.clientAPI = new Client(localContext.host!); // retrieve instanceId from local DB
// La clé est persistée en base locale (`TabletAppContext.toMap`) : l'oublier ici
// reconstruisait un client anonyme au démarrage, et tous les appels suivants
// à commencer par `deviceGetDetail` juste en dessous, qui donne la configuration
// à afficher partaient sans identité.
localContext.clientAPI = new Client(localContext.host!, apiKey: localContext.apiKey);
isConfig = localContext.configuration != null;
print(localContext);
print("localContext.deviceId");