TNC Route Fixed
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user