7 changed files with 79 additions and 39 deletions
@ -0,0 +1,16 @@
|
||||
// core/extensions/http_response_extension.dart |
||||
import 'package:dio/dio.dart'; |
||||
|
||||
extension HttpResponseExtension on Response { |
||||
bool get isSuccess { |
||||
return statusCode != null && statusCode! >= 200 && statusCode! < 300; |
||||
} |
||||
|
||||
bool get isClientError { |
||||
return statusCode != null && statusCode! >= 400 && statusCode! < 500; |
||||
} |
||||
|
||||
bool get isServerError { |
||||
return statusCode != null && statusCode! >= 500 && statusCode! < 600; |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
// lib/data/api_endpoints.dart |
||||
abstract class ApiEndpoints { |
||||
static const String baseUrl = 'https://xhdev.anxincloud.cn'; |
||||
|
||||
// 定义 Accounts 相关的端点 |
||||
static const String postLogin = '/api/Accounts/SignIn'; |
||||
static const String postRefreshToken = '/api/Accounts/RefreshToken'; |
||||
static const String getUserProfile = '/api/Accounts/Profile'; |
||||
static const String patchPassword = '/api/Accounts/ChangePassword'; |
||||
|
||||
// 定义 Memorandum 相关的端点 |
||||
static const String getProblem = '/api/Memorandum'; |
||||
static const String postProblem = '/api/Memorandum'; |
||||
static const String deleteProblem = '/api/Memorandum'; |
||||
static String putProblemById(String id) => '/api/Memorandum/$id'; |
||||
static String deleteProblemById(String id) => '/api/Memorandum/$id'; |
||||
|
||||
// 文件上传相关 |
||||
static const String postUploadFile = '/api/Objects/association'; |
||||
} |
Loading…
Reference in new issue