27 lines
1.7 KiB
Markdown
27 lines
1.7 KiB
Markdown
|
|
## Changes Made
|
||
|
|
|
||
|
|
### Authentication & Global State
|
||
|
|
- **[auth_state.dart](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS%20PROJECT/Employee%20Portal%20Design/flutter-code/lib/auth_state.dart)**: Added `accessToken`, `id1`, `id2`, and `id3` as global variables and updated the `logout()` function to clear them.
|
||
|
|
- **[login_page.dart](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS%20PROJECT/Employee%20Portal%20Design/flutter-code/lib/pages/login/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](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS%20PROJECT/Employee%20Portal%20Design/flutter-code/lib/api/leave/leave_api.dart)**: Refactored `getDropdownBawahan` to use the globally stored `accessToken`, `id1`, `id2`, and `id3` as 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](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS%20PROJECT/Employee%20Portal%20Design/flutter-code/lib/pages/login/login_page.dart) correctly parses the response:
|
||
|
|
```dart
|
||
|
|
accessToken = result['data']?['access_token'];
|
||
|
|
id1 = result['data']?['id1']?.toString();
|
||
|
|
// ... etc
|
||
|
|
```
|
||
|
|
And [leave_api.dart](file:///home/itc43/Documents/HOKBEN_PROJECT/ESS%20PROJECT/Employee%20Portal%20Design/flutter-code/lib/api/leave/leave_api.dart) correctly consumes them:
|
||
|
|
```dart
|
||
|
|
final String activeToken = token ?? accessToken ?? "";
|
||
|
|
// ... etc
|
||
|
|
```
|