You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
doctor_app_flutter/lib/providers/auth_provider.dart

35 lines
1.0 KiB
Dart

import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http;
import '../models/user_model.dart';
class AuthProvider with ChangeNotifier {
Future<Map> login(UserModel userInfo) async {
Map<String, String> requestHeaders = {
'Content-type': 'application/json',
'Accept': 'application/json',
};
const url =
'https://hmgwebservices.com/Services/Sentry.svc/REST/MemberLogIN_New';
try {
final response = await http.post(url,
headers: requestHeaders,
body: json.encode({
"UserID": userInfo.UserID,
"Password": userInfo.Password,
"ProjectID": userInfo.ProjectID,
"LanguageID": userInfo.LanguageID,
"IPAdress": userInfo.IPAdress,
"VersionID": userInfo.VersionID,
"Channel": userInfo.Channel,
"SessionID": userInfo.SessionID
}));
return Future.value(json.decode(response.body));
} catch (error) {
print(error);
}
}
}