add get user to user services and chanfge name

This commit is contained in:
2025-07-02 12:22:09 +02:00
parent afc47c33d9
commit b93478ddf4

View File

@@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
import 'package:supertokens_flutter/http.dart' as http;
import 'package:supertokens_flutter/supertokens.dart';
class MihUserApis {
class MihUserServices {
final baseAPI = AppEnviroment.baseApiUrl;
static Future<bool> isUsernameUnique(
@@ -30,6 +30,26 @@ class MihUserApis {
}
}
Future<AppUser?> getUserDetails(
String app_id,
BuildContext context,
) async {
var response = await http.get(
Uri.parse("${AppEnviroment.baseApiUrl}/user/$app_id"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
);
if (response.statusCode == 200) {
String body = response.body;
var jsonBody = jsonDecode(body);
return AppUser.fromJson(jsonBody);
} else {
return null;
}
}
Future<int> updateUser(
AppUser signedInUser,
String firstName,