Refactor code structure for improved readability and maintainability
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -24,7 +24,7 @@ class ApiClient {
|
||||
if (token != null) 'Authorization': 'Bearer $token',
|
||||
};
|
||||
|
||||
Future<Map<String, dynamic>> getJson(String path, {String? token}) async {
|
||||
Future<dynamic> getJson(String path, {String? token}) async {
|
||||
final response = await _client.get(
|
||||
Uri.parse('$baseUrl$path'),
|
||||
headers: _headers(token: token),
|
||||
|
||||
@@ -28,6 +28,15 @@ class PantryApiPaths {
|
||||
static String remove(int id) => '/pantry/$id';
|
||||
}
|
||||
|
||||
class UserApiPaths {
|
||||
static const me = '/users/me';
|
||||
static const list = '/users';
|
||||
static String setRole(int id) => '/users/$id/role';
|
||||
static String setPremium(int id) => '/users/$id/premium';
|
||||
static String delete(int id) => '/users/$id';
|
||||
static String resetPassword(int id) => '/users/$id/reset-password';
|
||||
}
|
||||
|
||||
class MealPlanApiPaths {
|
||||
static const list = '/meal-plan';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user