Done Category, Product Catalogue, Customer, Vendor, Purchase Invoice Module

This commit is contained in:
2026-08-28 11:30:18 +05:30
parent 0d13833679
commit 189f49ed07
118 changed files with 12624 additions and 4004 deletions

View File

@@ -15,10 +15,13 @@ class AuthRepository {
Future<void> signup(String email, String password) async {
try {
await _ensureCryptoReady();
await dio.post('/auth/signup', data: {
'email': _crypto.encrypt(email),
'password': _crypto.encrypt(password),
});
await dio.post(
'/auth/signup',
data: {
'email': _crypto.encrypt(email),
'password': _crypto.encrypt(password),
},
);
} on DioException catch (e) {
final data = e.response?.data;
final errorMsg = data is Map ? data['error'] : data;
@@ -30,7 +33,9 @@ class AuthRepository {
try {
return await _attemptLogin(email, password);
} on DioException catch (e) {
if (e.response?.statusCode == 500 || e.response?.statusCode == 400 || e.response?.statusCode == 401) {
if (e.response?.statusCode == 500 ||
e.response?.statusCode == 400 ||
e.response?.statusCode == 401) {
_crypto.clearKey();
try {
return await _attemptLogin(email, password);
@@ -46,21 +51,27 @@ class AuthRepository {
}
}
Future<Map<String, dynamic>> _attemptLogin(String email, String password) async {
Future<Map<String, dynamic>> _attemptLogin(
String email,
String password,
) async {
await _ensureCryptoReady();
final response = await dio.post('/auth/login', data: {
'email': _crypto.encrypt(email),
'password': _crypto.encrypt(password),
});
final response = await dio.post(
'/auth/login',
data: {
'email': _crypto.encrypt(email),
'password': _crypto.encrypt(password),
},
);
return response.data;
}
Future<Map<String, dynamic>> verifyOtp(String email, String otp) async {
try {
final response = await dio.post('/auth/verify-otp', data: {
'email': email,
'otp': otp,
});
final response = await dio.post(
'/auth/verify-otp',
data: {'email': email, 'otp': otp},
);
return response.data;
} on DioException catch (e) {
final data = e.response?.data;
@@ -71,9 +82,7 @@ class AuthRepository {
Future<void> forgotPassword(String email) async {
try {
await dio.post('/auth/forgot-password', data: {
'email': email,
});
await dio.post('/auth/forgot-password', data: {'email': email});
} on DioException catch (e) {
final data = e.response?.data;
final errorMsg = data is Map ? data['error'] : data;
@@ -81,14 +90,21 @@ class AuthRepository {
}
}
Future<void> resetPassword(String email, String otp, String newPassword) async {
Future<void> resetPassword(
String email,
String otp,
String newPassword,
) async {
try {
await _ensureCryptoReady();
await dio.post('/auth/reset-password', data: {
'email': email,
'otp': otp,
'newPassword': _crypto.encrypt(newPassword),
});
await dio.post(
'/auth/reset-password',
data: {
'email': email,
'otp': otp,
'newPassword': _crypto.encrypt(newPassword),
},
);
} on DioException catch (e) {
final data = e.response?.data;
final errorMsg = data is Map ? data['error'] : data;