added goal feature

This commit is contained in:
Mohamed Nouffer
2022-10-12 21:46:17 +05:30
parent 0470e1f27f
commit 8e30ee6ba7
29 changed files with 876 additions and 481 deletions

View File

@ -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();