1.7 KiB
1.7 KiB
Changes Made
Authentication & Global State
- auth_state.dart: Added
accessToken,id1,id2, andid3as global variables and updated thelogout()function to clear them. - login_page.dart: Updated the login handler to capture these new credentials from the API response and store them in the global state.
API Layer
- leave_api.dart: Refactored
getDropdownBawahanto use the globally storedaccessToken,id1,id2, andid3as default values. This simplifies API calls from the UI layer as these parameters are now optional.
Verification Results
Static Analysis
Ran flutter analyze on the modified files. No errors were found; only minor styling/linting suggestions (like avoid_print and deprecated withOpacity) were noted, but they do not affect functionality.
Manual Code Verification
Confirmed that login_page.dart correctly parses the response:
accessToken = result['data']?['access_token'];
id1 = result['data']?['id1']?.toString();
// ... etc
And leave_api.dart correctly consumes them:
final String activeToken = token ?? accessToken ?? "";
// ... etc