feat: Refactor user data fetching to use base URL from ApiEndpoints for improved maintainability
This commit is contained in:
parent
0ad8847b94
commit
d765b96df4
@ -8,12 +8,13 @@ import 'package:marco/model/employee_info.dart';
|
||||
import 'package:marco/model/projects_model.dart';
|
||||
import 'package:marco/helpers/services/storage/local_storage.dart';
|
||||
import 'package:marco/helpers/services/auth_service.dart';
|
||||
import 'package:marco/helpers/services/api_endpoints.dart';
|
||||
|
||||
final Logger logger = Logger();
|
||||
|
||||
class PermissionService {
|
||||
static final Map<String, Map<String, dynamic>> _userDataCache = {};
|
||||
|
||||
static const String _baseUrl = ApiEndpoints.baseUrl;
|
||||
/// Fetches all user-related data (permissions, employee info, projects)
|
||||
static Future<Map<String, dynamic>> fetchAllUserData(
|
||||
String token, {
|
||||
@ -24,7 +25,7 @@ class PermissionService {
|
||||
return _userDataCache[token]!;
|
||||
}
|
||||
|
||||
final uri = Uri.parse('https://stageapi.marcoaiot.com/api/user/profile');
|
||||
final uri = Uri.parse("$_baseUrl/user/profile");
|
||||
final headers = {'Authorization': 'Bearer $token'};
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user