feat:增加服务器接口模块
This commit is contained in:
11
lib/apis/auth_api.dart
Normal file
11
lib/apis/auth_api.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:sweet_chat_app/models/auth.dart';
|
||||
import 'package:sweet_chat_app/services/dio_service.dart';
|
||||
|
||||
Future<Auth> loginApi(String username, String password) async {
|
||||
final res = await dioService.post(
|
||||
'/auth/login',
|
||||
data: {'username': username, 'password': password},
|
||||
);
|
||||
|
||||
return Auth.fromJson(res.data);
|
||||
}
|
||||
Reference in New Issue
Block a user