import 'package:cheminova/utils/common_api_service.dart'; import 'package:cheminova/utils/show_snackbar.dart'; class AuthService { Future?> login(Map data) async { try { final response = await commonApiService>( url: '/api/v1/user/login/', method: 'POST', body: data, fromJson: (json) => json, // Simply return the JSON map as is ); return response; } catch (e) { showSnackbar(e.toString()); } return null; } Future?> forgotPassword(Map data) async { try { final response = await commonApiService>( url: '/api/v1/user/password/forgot', method: 'POST', body: data, fromJson: (json) => json, // Simply return the JSON map as is ); return response; } catch (e) { showSnackbar(e.toString()); } return null; } Future?> changePassword(Map data, {required String token}) async { try { final response = await commonApiService>( url: '/api/v1/user/password/update', method: 'PUT', body: data, fromJson: (json) => json, // Simply return the JSON map as is additionalHeaders: { // Pass the token here 'Authorization': 'Bearer $token', }, ); return response; } catch (e) { showSnackbar(e.toString()); } return null; } }