mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
60 lines
1.6 KiB
Dart
60 lines
1.6 KiB
Dart
import 'package:syncrow_web/pages/auth/model/token.dart';
|
|
import 'package:syncrow_web/services/api/http_service.dart';
|
|
import 'package:syncrow_web/utils/constants/api_const.dart';
|
|
|
|
class AuthenticationAPI {
|
|
|
|
static Future<Token> loginWithEmail({required var model}) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.login,
|
|
body: model.toJson(),
|
|
showServerMessage: true,
|
|
expectedResponseModel: (json) {
|
|
return Token.fromJson(json['data']);
|
|
});
|
|
return response;
|
|
}
|
|
|
|
static Future forgetPassword({ required var email, required var password}) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.forgetPassword,
|
|
body: {
|
|
"email": email,
|
|
"password": password
|
|
},
|
|
showServerMessage: true,
|
|
expectedResponseModel: (json) {
|
|
});
|
|
return response;
|
|
}
|
|
|
|
static Future sendOtp({ required var email}) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.sendOtp,
|
|
body: {
|
|
"email": email,
|
|
"type": "VERIFICATION"
|
|
},
|
|
showServerMessage: true,
|
|
expectedResponseModel: (json) {
|
|
print('json===$json');
|
|
});
|
|
|
|
return response;
|
|
}
|
|
|
|
static Future checkOtp({ required var email}) async {
|
|
final response = await HTTPService().post(
|
|
path: ApiEndpoints.sendOtp,
|
|
body: {
|
|
"email": email,
|
|
"type": "VERIFICATION"
|
|
},
|
|
showServerMessage: true,
|
|
expectedResponseModel: (json) {
|
|
});
|
|
|
|
return response;
|
|
}
|
|
}
|