update
This commit is contained in:
@ -1,13 +1,16 @@
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../utils/const.dart';
|
||||
|
||||
|
||||
class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> login(String email, String password) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
//String url = 'http://container.intranet.sumasen.net:8100/api/login/';
|
||||
String url = 'http://localhost:8100/api/login/';
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/login/';
|
||||
//String url = 'http://localhost:8100/api/login/';
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -28,8 +31,9 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> register(String email, String password) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
//String url = 'http://container.intranet.sumasen.net:8100/api/register/';
|
||||
String url = 'http://localhost:8100/api/register/';
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/register/';
|
||||
//String url = 'http://localhost:8100/api/register/';
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -48,6 +52,30 @@ class AuthService{
|
||||
}
|
||||
|
||||
|
||||
static Future<List<dynamic>?> UserDetails(int userid) async {
|
||||
List<dynamic> cats = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/userdetials?user_id=${userid}';
|
||||
//String url = 'http://localhost:8100/api/userdetials?user_id=${userid}';
|
||||
|
||||
|
||||
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/';
|
||||
print("---- cat url is ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user