diff --git a/lib/licensing/license_service.dart b/lib/licensing/license_service.dart index 01211c5..e2a88e7 100644 --- a/lib/licensing/license_service.dart +++ b/lib/licensing/license_service.dart @@ -141,19 +141,14 @@ class LicenseService { throw LicenseException(msg, code); } - final dataObj = body['data']; - if (dataObj is! Map) { - throw const LicenseException('Invalid response from licensing server', 'INVALID_RESPONSE'); - } - final data = dataObj; - final jwt = data['token'] as String?; + final jwt = body['token'] as String?; if (jwt == null) { throw const LicenseException('Invalid response from licensing server', 'INVALID_RESPONSE'); } await _persist(jwt); - final tier = _parseTier(data['tier'] as String? ?? 'free'); - final features = _parseFeatures(data['features']); + final tier = _parseTier(body['tier'] as String? ?? 'free'); + final features = _parseFeatures(body['features']); return LicenseState( status: LicenseStatus.active, tier: tier, @@ -190,13 +185,9 @@ class LicenseService { if (resp.statusCode == 200) { if (decoded is Map) { final body = decoded; - final dataObj = body['data']; - if (dataObj is Map) { - final data = dataObj; - final newJwt = data['token'] as String?; - if (newJwt != null) { - await _persist(newJwt); - } + final newJwt = body['token'] as String?; + if (newJwt != null) { + await _persist(newJwt); } } return loadCachedState();