You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
880 B

import 'package:flutter/cupertino.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
miniLogin(ApiService apiService, String storeId, Function(String token) callback) async {
apiService.minLogin(storeId).then((baseData) async {
if (baseData?.isSuccess ?? false) {
callback.call(baseData.data["token"]);
}
}, onError: (error) {
SmartDialog.showToast(
AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center,
);
debugPrint("${error}");
return Future.value(null);
}).catchError((onError) {
SmartDialog.showToast(
AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center,
);
debugPrint("${onError}");
return Future.value(null);
});
}