added goal feature
This commit is contained in:
@ -6,6 +6,30 @@ import '../utils/const.dart';
|
||||
|
||||
class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> changePassword(String oldpassword, String newpassword, String token) async {
|
||||
Map<String, dynamic> changePassword = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/change-password/';
|
||||
print('---- toekn is ${token} -----');
|
||||
final http.Response response = await http.put(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token ${token}'
|
||||
},
|
||||
body: jsonEncode(<String, String>{
|
||||
'old_password': oldpassword,
|
||||
'new_password': newpassword
|
||||
}),
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
changePassword = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
return changePassword;
|
||||
}
|
||||
|
||||
|
||||
static Future<Map<String, dynamic>> login(String email, String password) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
@ -51,7 +75,7 @@ class AuthService{
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Future<List<dynamic>?> UserDetails(int userid) async {
|
||||
List<dynamic> cats = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
|
||||
Reference in New Issue
Block a user