TNC Route Fixed

This commit is contained in:
2025-11-10 12:39:31 +05:30
parent 3e88aad43f
commit 5c8df8ace3
7 changed files with 301 additions and 84 deletions

View File

@@ -61,8 +61,21 @@ class AuthToken extends Equatable {
return false;
}
// Assuming 'tnc' is directly a boolean in the JWT payload
return payloadMap['tnc'] as bool;
final tncValue = payloadMap['tnc'];
// Handle different representations of 'true'
if (tncValue is bool) {
return tncValue;
}
if (tncValue is String) {
return tncValue.toLowerCase() == 'true';
}
if (tncValue is int) {
return tncValue == 1;
}
// Default to false for any other case
return false;
} catch (e) {
log('Error decoding tnc from token: $e');
// Default to false if decoding fails or 'tnc' is not found/invalid