mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-14 17:25:47 +00:00
Refactor code for better readability and maintainability
- Add method to get token and validate in AuthCubit - Update AuthState with loading, success, and error states for token - Use BlocBuilder in SplashView for token validation and navigation This commit refactors the code in AuthCubit to include a method to get the token and validate it. It also updates the AuthState with loading, success, and error states for token handling. In SplashView, BlocBuilder is now used to handle token validation and navigation based on the token status.
This commit is contained in:
@ -23,13 +23,11 @@ class DevicesAPI {
|
||||
Map<String, dynamic> params = {
|
||||
"homeId": spaceId,
|
||||
"pageSize": 100,
|
||||
"page": 1
|
||||
"pageNo": 1
|
||||
};
|
||||
final response = await _httpService.get(
|
||||
path:
|
||||
"https://syncrow.azurewebsites.net/group?homeId=$spaceId&pageSize=100&pageNo=1",
|
||||
// path: ApiEndpoints.groups,
|
||||
// queryParameters: params,
|
||||
path: ApiEndpoints.groups,
|
||||
queryParameters: params,
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) =>
|
||||
DevicesCategoryModel.fromJsonList(json['groups']),
|
||||
|
Reference in New Issue
Block a user