- 引入 dio,封装统一 ApiClient(BaseUrl/Token 注入/401 自动刷新/{code,message,data} 解包)
- TokenStorage 令牌持久化,AuthController 登录状态管理
- AuthRepository 封装 otp/login/logout 接口
- 登录页对接手机号/邮箱验证码登录(Google 登录待 OAuth client 配置)
16 lines
398 B
Dart
16 lines
398 B
Dart
// Author: fruit.com.cn
|
|
|
|
/// 接口地址与超时配置。
|
|
class ApiConfig {
|
|
ApiConfig._();
|
|
|
|
/// 客户端 app-api 地址,可用 --dart-define=API_BASE_URL=... 覆盖。
|
|
static const String baseUrl = String.fromEnvironment(
|
|
'API_BASE_URL',
|
|
defaultValue: 'http://127.0.0.1:8081',
|
|
);
|
|
|
|
static const int connectTimeoutSeconds = 10;
|
|
static const int receiveTimeoutSeconds = 15;
|
|
}
|