first step form real login and calling Api
parent
da3cc456ba
commit
7227c71393
@ -0,0 +1,20 @@
|
||||
class UserModel {
|
||||
String UserID;
|
||||
String Password;
|
||||
int ProjectID;
|
||||
int LanguageID;
|
||||
String IPAdress;
|
||||
double VersionID;
|
||||
int Channel;
|
||||
String SessionID;
|
||||
|
||||
UserModel(
|
||||
{this.UserID,
|
||||
this.Password,
|
||||
this.ProjectID,
|
||||
this.LanguageID,
|
||||
this.IPAdress,
|
||||
this.VersionID,
|
||||
this.Channel,
|
||||
this.SessionID});
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue