37 lines
748 B
Dart
37 lines
748 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:fcs/model/api_helper.dart';
|
|
import 'package:fcs/model/main_model.dart';
|
|
|
|
import '../vo/setting.dart';
|
|
import '../vo/user.dart';
|
|
|
|
abstract class BaseModel extends ChangeNotifier {
|
|
User user;
|
|
Setting setting;
|
|
MainModel mainModel;
|
|
|
|
void initUser(User user) async {
|
|
this.user = user;
|
|
}
|
|
|
|
void initSetting(Setting setting) async {
|
|
this.setting = setting;
|
|
}
|
|
|
|
void logout();
|
|
|
|
// request makes http request
|
|
// if token is null
|
|
dynamic request(
|
|
String path,
|
|
method, {
|
|
dynamic payload,
|
|
String token,
|
|
String url,
|
|
}) async {
|
|
mainModel.resetPinTimer();
|
|
return await requestAPI(path, method,
|
|
payload: payload, token: token, url: url);
|
|
}
|
|
}
|