auth with password added
This commit is contained in:
parent
b49beb06e8
commit
cd0c924cff
@ -1,7 +1,5 @@
|
|||||||
// api_config.dart
|
// api_config.dart
|
||||||
// const String apiUrl = 'http://127.0.0.1:8090';
|
// const String apiUrl = 'http://127.0.0.1:8090';
|
||||||
// const String apiUrl = 'https://pbdev.venbait.in/';
|
// const String apiUrl = 'https://pbdev.venbait.in/';
|
||||||
const String apiUrl = 'https://pb.venbait.in/';
|
// const String apiUrl = 'https://pb.venbait.in/';
|
||||||
// const String apiUrl = 'https://pocket.fcsc.gov.ae';
|
const String apiUrl = 'https://pocket.fcsc.gov.ae/';
|
||||||
// const String auth = 'kannan@sightspectrum.com';
|
|
||||||
// const String authpw = '1DgZ_we3k5UuCZiF9wziwECQzQo1YNRQ';
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:uae_stat/config/theme/auth_provider.dart';
|
|||||||
import 'package:uae_stat/config/theme/service.dart';
|
import 'package:uae_stat/config/theme/service.dart';
|
||||||
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
||||||
import 'package:uae_stat/domain/entities/session_entity.dart';
|
import 'package:uae_stat/domain/entities/session_entity.dart';
|
||||||
|
import 'package:uae_stat/infrastructure/services/pocketbase_service.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
@ -55,17 +56,17 @@ class _SessionCheckScreenState extends ConsumerState<SessionCheckScreen> {
|
|||||||
// final String adminToken = adminAuth.token;
|
// final String adminToken = adminAuth.token;
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
print('adminToken: $adminToken');
|
// print('adminToken: $adminToken');
|
||||||
|
|
||||||
// Fetch user details
|
// Fetch user details
|
||||||
final userDetailsResponse = await pb.collection('users').getOne(
|
final userDetailsResponse = await pb.collection('users').getOne(
|
||||||
userId!,
|
userId!,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer $adminToken',
|
'Authorization': 'Bearer ${PocketBaseService.authStore.token}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:uae_stat/infrastructure/services/pocketbase_service.dart';
|
||||||
|
|
||||||
class AuthState {
|
class AuthState {
|
||||||
final String email;
|
final String email;
|
||||||
|
|||||||
@ -56,32 +56,32 @@ class ThemeBaseService {
|
|||||||
|
|
||||||
Future<dynamic> getUserTheme(String userId, WidgetRef ref) async {
|
Future<dynamic> getUserTheme(String userId, WidgetRef ref) async {
|
||||||
print('getUserTheme');
|
print('getUserTheme');
|
||||||
final url = "${pb.baseUrl}/api/collections/users/records/$userId";
|
final url = "${pb.baseUrl}api/collections/users/records/$userId";
|
||||||
|
|
||||||
// final adminAuth = await pb.admins.authWithPassword(
|
// final adminAuth = await pb.admins.authWithPassword(
|
||||||
// 'pb@venbainfotech.com',
|
// 'pb@venbainfotech.com',
|
||||||
// 'pb@venbainfotech.com',
|
// 'pb@venbainfotech.com',
|
||||||
// );
|
// );
|
||||||
|
|
||||||
final auth = ref.watch(authProvider);
|
// final auth = ref.watch(authProvider);
|
||||||
|
|
||||||
final adminAuth = await pb.admins.authWithPassword(
|
// final adminAuth = await pb.admins.authWithPassword(
|
||||||
auth.email,
|
// auth.email,
|
||||||
auth.password,
|
// auth.password,
|
||||||
);
|
// );
|
||||||
|
|
||||||
// final adminAuth = await PocketBaseService.users.authWithPassword(
|
// final adminAuth = await PocketBaseService.users.authWithPassword(
|
||||||
// 'sangeethae9919@gmail.com',
|
// 'sangeethae9919@gmail.com',
|
||||||
// 'Sang@123',
|
// 'Sang@123',
|
||||||
// );
|
// );
|
||||||
|
|
||||||
final String adminToken = adminAuth.token;
|
// final String adminToken = adminAuth.token;
|
||||||
print('adminToken: $adminToken');
|
// print('adminToken: $adminToken');
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': 'Bearer $adminToken'
|
'Authorization': 'Bearer ${PocketBaseService.authStore.token}'
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class ThemeBaseService {
|
|||||||
String userId, String theme, WidgetRef ref) async {
|
String userId, String theme, WidgetRef ref) async {
|
||||||
print('updateUserTheme');
|
print('updateUserTheme');
|
||||||
// Authenticate admin d
|
// Authenticate admin d
|
||||||
final url = "${pb.baseUrl}/api/collections/users/records/$userId";
|
final url = "${pb.baseUrl}api/collections/users/records/$userId";
|
||||||
// final adminAuth = await pb.admins.authWithPassword(
|
// final adminAuth = await pb.admins.authWithPassword(
|
||||||
// 'pb@venbainfotech.com',
|
// 'pb@venbainfotech.com',
|
||||||
// 'pb@venbainfotech.com',
|
// 'pb@venbainfotech.com',
|
||||||
@ -112,18 +112,18 @@ class ThemeBaseService {
|
|||||||
|
|
||||||
final auth = ref.watch(authProvider);
|
final auth = ref.watch(authProvider);
|
||||||
|
|
||||||
final adminAuth = await pb.admins.authWithPassword(
|
// final adminAuth = await pb.admins.authWithPassword(
|
||||||
auth.email,
|
// auth.email,
|
||||||
auth.password,
|
// auth.password,
|
||||||
);
|
// );
|
||||||
final String adminToken = adminAuth.token;
|
// final String adminToken = adminAuth.token;
|
||||||
print('adminToken: $adminToken');
|
print('adminToken: ${PocketBaseService.authStore.token}');
|
||||||
|
|
||||||
final response = await http.patch(
|
final response = await http.patch(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': 'Bearer $adminToken',
|
'Authorization': 'Bearer ${PocketBaseService.authStore.token}',
|
||||||
},
|
},
|
||||||
body: jsonEncode({
|
body: jsonEncode({
|
||||||
'theme': theme, // light, dark, or system
|
'theme': theme, // light, dark, or system
|
||||||
|
|||||||
@ -231,11 +231,9 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
isRegistering = true; // Disable the button
|
isRegistering = true; // Disable the button
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
final adminAuth = await pb.admins
|
|
||||||
.authWithPassword('kannan@sightspectrum.com', '1DgZ_we3k5UuCZiF9wziwECQzQo1YNRQ');
|
|
||||||
|
|
||||||
final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
print('adminTokenREgistration- ${adminToken}');
|
// print('adminTokenREgistration- ${adminToken}');
|
||||||
var mailID = _emailController.text;
|
var mailID = _emailController.text;
|
||||||
var email = mailID.toLowerCase();
|
var email = mailID.toLowerCase();
|
||||||
// Create user in PocketBase
|
// Create user in PocketBase
|
||||||
@ -247,7 +245,7 @@ class _RegisterScreenState extends ConsumerState<RegisterScreen> {
|
|||||||
'status': 'Pending',
|
'status': 'Pending',
|
||||||
'role': 'user',
|
'role': 'user',
|
||||||
}, headers: {
|
}, headers: {
|
||||||
'Authorization': adminToken
|
// 'Authorization': adminToken
|
||||||
});
|
});
|
||||||
if (response.id != null) {
|
if (response.id != null) {
|
||||||
userID = response.id;
|
userID = response.id;
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import 'package:uae_stat/config/toast_util.dart';
|
|||||||
import 'package:uae_stat/config/toggle_lang_service.dart';
|
import 'package:uae_stat/config/toggle_lang_service.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart';
|
||||||
|
import 'package:uae_stat/infrastructure/services/pocketbase_service.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/charts/services/api_service.dart';
|
import 'package:uae_stat/presentation/Screens/charts/services/api_service.dart';
|
||||||
import 'package:uae_stat/presentation/Screens/charts/widgets/chart_widget.dart';
|
import 'package:uae_stat/presentation/Screens/charts/widgets/chart_widget.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
@ -157,15 +158,15 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
// final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
|
|
||||||
final result = await _pb.collection('bookmark').getList(
|
final result = await _pb.collection('bookmark').getList(
|
||||||
filter: "user_id = '${userID}' && dataset = '${widget.dataSets}'",
|
filter: "user_id = '${userID}' && dataset = '${widget.dataSets}'",
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': adminToken, // Pass the admin token
|
'Authorization': PocketBaseService.authStore.token, // Pass the admin token
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -190,11 +191,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
|
|
||||||
final auth = ref.watch(authProvider);
|
final auth = ref.watch(authProvider);
|
||||||
|
|
||||||
final adminAuth = await pb.admins.authWithPassword(
|
// final adminAuth = await pb.admins.authWithPassword(
|
||||||
auth.email,
|
// auth.email,
|
||||||
auth.password,
|
// auth.password,
|
||||||
);
|
// );
|
||||||
final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
final response = await _pb.collection('bookmark').create(body: {
|
final response = await _pb.collection('bookmark').create(body: {
|
||||||
'user_id': userID,
|
'user_id': userID,
|
||||||
'dataset': widget.dataSets,
|
'dataset': widget.dataSets,
|
||||||
@ -203,7 +204,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
'title': widget.title,
|
'title': widget.title,
|
||||||
'keyParam': widget.keyParam,
|
'keyParam': widget.keyParam,
|
||||||
}, headers: {
|
}, headers: {
|
||||||
'Authorization': adminToken
|
'Authorization': PocketBaseService.authStore.token
|
||||||
});
|
});
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -250,12 +251,12 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
|||||||
/// Remove bookmark from PocketBase
|
/// Remove bookmark from PocketBase
|
||||||
Future<void> removeBookmark() async {
|
Future<void> removeBookmark() async {
|
||||||
try {
|
try {
|
||||||
final adminAuth = await _pb.admins
|
// final adminAuth = await _pb.admins
|
||||||
.authWithPassword('pb@venbainfotech.com', 'pb@venbainfotech.com');
|
// .authWithPassword('pb@venbainfotech.com', 'pb@venbainfotech.com');
|
||||||
final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
if (bookmarkId != null) {
|
if (bookmarkId != null) {
|
||||||
await _pb.collection('bookmark').delete(bookmarkId!, headers: {
|
await _pb.collection('bookmark').delete(bookmarkId!, headers: {
|
||||||
'Authorization': adminToken,
|
'Authorization': PocketBaseService.authStore.token,
|
||||||
});
|
});
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@ -13,7 +13,7 @@ class ChartData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ApiService {
|
class ApiService {
|
||||||
static const String baseUrl = '$apiUrl/api/getDataSet';
|
static const String baseUrl = '${apiUrl}api/getDataSet';
|
||||||
|
|
||||||
Future<Map<String, dynamic>> fetchChartData(String dataSets, locale, kpi,
|
Future<Map<String, dynamic>> fetchChartData(String dataSets, locale, kpi,
|
||||||
List<Map<String, dynamic>> filterData, themeMode) async {
|
List<Map<String, dynamic>> filterData, themeMode) async {
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import 'package:uae_stat/config/theme/theme_provider.dart';
|
|||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart';
|
||||||
|
import 'package:uae_stat/infrastructure/services/pocketbase_service.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
import 'package:uae_stat/presentation/components/my_toggle.dart';
|
import 'package:uae_stat/presentation/components/my_toggle.dart';
|
||||||
import 'package:uae_stat/l10n/app_localizations.dart';
|
import 'package:uae_stat/l10n/app_localizations.dart';
|
||||||
@ -178,15 +179,15 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
|
|||||||
// final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
print('adminToken- ${adminToken}');
|
// print('adminToken- ${adminToken}');
|
||||||
final userDetailsResponse = await _pb.collection('users').getOne(
|
final userDetailsResponse = await _pb.collection('users').getOne(
|
||||||
widget.userId,
|
widget.userId,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer $adminToken',
|
'Authorization': 'Bearer ${PocketBaseService.authStore.token}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
print('userDetails: $userDetailsResponse');
|
print('userDetails: $userDetailsResponse');
|
||||||
@ -375,7 +376,7 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
|
|||||||
|
|
||||||
// Create a multipart request
|
// Create a multipart request
|
||||||
final uri =
|
final uri =
|
||||||
Uri.parse('${_pb.baseUrl}/api/collections/users/records/$userID');
|
Uri.parse('${_pb.baseUrl}api/collections/users/records/$userID');
|
||||||
final request = http.MultipartRequest('PATCH', uri);
|
final request = http.MultipartRequest('PATCH', uri);
|
||||||
|
|
||||||
// Add other fields
|
// Add other fields
|
||||||
|
|||||||
@ -74,15 +74,15 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
// Fetch user details
|
// Fetch user details
|
||||||
final userDetailsResponse = await pb.collection('users').getOne(
|
final userDetailsResponse = await pb.collection('users').getOne(
|
||||||
userId,
|
userId,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer $adminToken',
|
'Authorization': 'Bearer ${PocketBaseService.authStore.token}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
|
|
||||||
Future<void> updateDeviceToken(
|
Future<void> updateDeviceToken(
|
||||||
String userId, String token, WidgetRef ref) async {
|
String userId, String token, WidgetRef ref) async {
|
||||||
final url = "${pb.baseUrl}/api/collections/users/records/$userId";
|
final url = "${pb.baseUrl}api/collections/users/records/$userId";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Authenticate admin (Persist session globally instead)
|
// Authenticate admin (Persist session globally instead)
|
||||||
@ -203,16 +203,16 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
|
|
||||||
final response = await http.patch(
|
final response = await http.patch(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json', // Add this
|
'Content-Type': 'application/json', // Add this
|
||||||
'Authorization': pb.authStore.token, // Correct way to send auth token
|
'Authorization': PocketBaseService.authStore.token, // Correct way to send auth token
|
||||||
},
|
},
|
||||||
body: jsonEncode({
|
body: jsonEncode({
|
||||||
"device_token": token,
|
"device_token": token,
|
||||||
@ -497,10 +497,10 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
final userDetails = metaDetails['rawUser'];
|
final userDetails = metaDetails['rawUser'];
|
||||||
print('oauthDetails $userDetails');
|
print('oauthDetails $userDetails');
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ class LoginRoute extends HookConsumerWidget {
|
|||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json', // Add this
|
'Content-Type': 'application/json', // Add this
|
||||||
'Authorization': pb.authStore.token, // Correct way to send auth token
|
'Authorization': PocketBaseService.authStore.token, // Correct way to send auth token
|
||||||
},
|
},
|
||||||
body: jsonEncode({
|
body: jsonEncode({
|
||||||
"user_mail_verify": true,
|
"user_mail_verify": true,
|
||||||
|
|||||||
@ -114,7 +114,7 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -1017,7 +1017,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getHomePageData';
|
const baseUrl = '${apiUrl}api/getHomePageData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
@ -128,7 +128,7 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final response = await Dio().get(
|
final response = await Dio().get(
|
||||||
'$apiUrl/api/getUserBookmark',
|
'${apiUrl}api/getUserBookmark',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'user_id': userID,
|
'user_id': userID,
|
||||||
'language': locale,
|
'language': locale,
|
||||||
@ -264,18 +264,18 @@ class _BookMarkState extends ConsumerState<BookMark> {
|
|||||||
//
|
//
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
print('adminTokenETRE1- ');
|
// print('adminTokenETRE1- ');
|
||||||
|
|
||||||
// final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
|
|
||||||
print('adminTokenETRE- $adminToken');
|
// print('adminTokenETRE- $adminToken');
|
||||||
|
|
||||||
await _pb.collection('bookmark').delete(bookmarkId!, headers: {
|
await _pb.collection('bookmark').delete(bookmarkId!, headers: {
|
||||||
'Authorization': adminToken,
|
'Authorization': PocketBaseService.authStore.token,
|
||||||
});
|
});
|
||||||
|
|
||||||
// currentTheme = ref.read(themeProvider);
|
// currentTheme = ref.read(themeProvider);
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class _ContactState extends ConsumerState<Contact> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(
|
Uri.parse(
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import 'package:uae_stat/config/theme/theme_provider.dart';
|
|||||||
import 'package:uae_stat/config/toggle_lang_service.dart';
|
import 'package:uae_stat/config/toggle_lang_service.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart';
|
||||||
|
import 'package:uae_stat/infrastructure/services/pocketbase_service.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
import 'package:uae_stat/presentation/routes/drawer_routes/Drawer%20Items/notification/notification.dart';
|
import 'package:uae_stat/presentation/routes/drawer_routes/Drawer%20Items/notification/notification.dart';
|
||||||
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
|
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
|
||||||
@ -197,15 +198,15 @@ class _EditProfileState extends ConsumerState<EditProfile> {
|
|||||||
// final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
print('adminToken- $adminToken');
|
// print('adminToken- $adminToken');
|
||||||
final userDetailsResponse = await _pb.collection('users').getOne(
|
final userDetailsResponse = await _pb.collection('users').getOne(
|
||||||
userId,
|
userId,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer $adminToken',
|
'Authorization': 'Bearer ${PocketBaseService.authStore.token}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -449,7 +450,7 @@ class _EditProfileState extends ConsumerState<EditProfile> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add headers (e.g., authorization)
|
// Add headers (e.g., authorization)
|
||||||
request.headers['Authorization'] = 'Bearer ${_pb.authStore.token}';
|
request.headers['Authorization'] = 'Bearer ${PocketBaseService.authStore.token}';
|
||||||
|
|
||||||
// Send the request
|
// Send the request
|
||||||
final response = await request.send();
|
final response = await request.send();
|
||||||
|
|||||||
@ -147,7 +147,7 @@ class _FeedbackFormState extends ConsumerState<FeedbackForm>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
@ -1018,13 +1018,13 @@ class _FeedbackFormState extends ConsumerState<FeedbackForm>
|
|||||||
// final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
final response = await _pb
|
final response = await _pb
|
||||||
.collection('feedback')
|
.collection('feedback')
|
||||||
.create(body: feedbackData, headers: {'Authorization': adminToken});
|
.create(body: feedbackData, headers: {'Authorization': PocketBaseService.authStore.token});
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
final createdTime = response.created;
|
final createdTime = response.created;
|
||||||
// Send email
|
// Send email
|
||||||
|
|||||||
@ -71,10 +71,10 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
final result = await _pb.collection('users').getFullList(
|
final result = await _pb.collection('users').getFullList(
|
||||||
filter: 'role="user"',
|
filter: 'role="user"',
|
||||||
);
|
);
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import 'package:uae_stat/config/theme/service.dart';
|
|||||||
import 'package:uae_stat/config/theme/theme_provider.dart';
|
import 'package:uae_stat/config/theme/theme_provider.dart';
|
||||||
import 'package:uae_stat/config/toggle_lang_service.dart';
|
import 'package:uae_stat/config/toggle_lang_service.dart';
|
||||||
import 'package:uae_stat/domain/use_cases/language.dart';
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
||||||
|
import 'package:uae_stat/infrastructure/services/pocketbase_service.dart';
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
import '../../custom_drawer_routes.dart';
|
import '../../custom_drawer_routes.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
@ -73,7 +74,7 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
@ -145,15 +146,15 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
// final adminToken = adminAuth.token;
|
// final adminToken = adminAuth.token;
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
print('adminToken- ${adminToken}');
|
// print('adminToken- ${adminToken}');
|
||||||
final userDetailsResponse = await _pb.collection('users').getOne(
|
final userDetailsResponse = await _pb.collection('users').getOne(
|
||||||
fetchedUserId!,
|
fetchedUserId!,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer $adminToken',
|
'Authorization': 'Bearer ${PocketBaseService.authStore.token}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
print('userDetails: $userDetailsResponse');
|
print('userDetails: $userDetailsResponse');
|
||||||
@ -195,7 +196,7 @@ class _NotificationPageState extends ConsumerState<NotificationPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchNotifications(locale) async {
|
Future<void> fetchNotifications(locale) async {
|
||||||
final baseUrl = apiUrl + '/api/getNotification';
|
final baseUrl = apiUrl + 'api/getNotification';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(Uri.parse('$baseUrl?language=$locale'),
|
final response = await http.get(Uri.parse('$baseUrl?language=$locale'),
|
||||||
headers: {'APP_SIGNATURE': 'fcsc.gov.ae.X7pL9qZm2A'});
|
headers: {'APP_SIGNATURE': 'fcsc.gov.ae.X7pL9qZm2A'});
|
||||||
@ -653,10 +654,10 @@ Future<void> readedNotification(
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
|
|
||||||
final url =
|
final url =
|
||||||
"${pb.baseUrl}api/removeNotification?user_id=$userId¬ification_id=$notificationId";
|
"${pb.baseUrl}api/removeNotification?user_id=$userId¬ification_id=$notificationId";
|
||||||
@ -666,7 +667,7 @@ Future<void> readedNotification(
|
|||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json', // Add this
|
'Content-Type': 'application/json', // Add this
|
||||||
'Authorization': pb.authStore.token, // Correct way to send auth token
|
'Authorization': PocketBaseService.authStore.token, // Correct way to send auth token
|
||||||
'APP_SIGNATURE': 'fcsc.gov.ae.X7pL9qZm2A'
|
'APP_SIGNATURE': 'fcsc.gov.ae.X7pL9qZm2A'
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class _NotificationDetailsState extends ConsumerState<NotificationDetails> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
@ -112,7 +112,7 @@ class _NotificationDetailsState extends ConsumerState<NotificationDetails> {
|
|||||||
|
|
||||||
Future<void> fetchNotifications(locale) async {
|
Future<void> fetchNotifications(locale) async {
|
||||||
notificationID = widget.id;
|
notificationID = widget.id;
|
||||||
final baseUrl = apiUrl + '/api/getNotification';
|
final baseUrl = apiUrl + 'api/getNotification';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse('$baseUrl?language=$locale&id=$notificationID'),
|
Uri.parse('$baseUrl?language=$locale&id=$notificationID'),
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class _aboutFCSCState extends ConsumerState<aboutFCSC> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class _GetStartedState extends ConsumerState<GetStarted> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class _AppFeaturesState extends ConsumerState<AppFeatures> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class _ChangeMyPasswordState extends ConsumerState<ChangeMyPassword> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class _EditMyProfileState extends ConsumerState<EditMyProfile> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class _HowUseTheAppState extends ConsumerState<HowUseTheApp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class _PurposeState extends ConsumerState<Purpose> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class _StayUpdateState extends ConsumerState<StayUpdate> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class _WhoUseTheAppState extends ConsumerState<WhoUseTheApp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class _aboutTheAppState extends ConsumerState<aboutTheApp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class _FAQPageState extends ConsumerState<FAQPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class _UsingFeaturesState extends ConsumerState<UsingFeatures> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchData(locale, themeMode) async {
|
Future<void> fetchData(locale, themeMode) async {
|
||||||
const baseUrl = '$apiUrl/api/getUAENumbersData';
|
const baseUrl = '${apiUrl}api/getUAENumbersData';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'),
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import 'package:uae_stat/domain/use_cases/language.dart';
|
|||||||
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/bottom_bar_asset_icon_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/bottom_bar_asset_icon_path.dart';
|
||||||
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/drawer_asset_icon_path.dart';
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/drawer_asset_icon_path.dart';
|
||||||
|
import 'package:uae_stat/infrastructure/services/pocketbase_service.dart';
|
||||||
import 'package:uae_stat/l10n/app_localizations.dart';
|
import 'package:uae_stat/l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
|
||||||
@ -714,14 +715,14 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
//print('adminToken- ${adminToken}');
|
//print('adminToken- ${adminToken}');
|
||||||
|
|
||||||
final themeService = ThemeBaseService();
|
final themeService = ThemeBaseService();
|
||||||
final adminToken = await themeService.getAdminToken(
|
// final adminToken = await themeService.getAdminToken(
|
||||||
email: auth.email,
|
// email: auth.email,
|
||||||
password: auth.password,
|
// password: auth.password,
|
||||||
);
|
// );
|
||||||
final userDetailsResponse = await _pb.collection('users').getOne(
|
final userDetailsResponse = await _pb.collection('users').getOne(
|
||||||
userId!,
|
userId!,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer $adminToken',
|
'Authorization': 'Bearer ${PocketBaseService.authStore.token}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
print('NAVuserDetails: $userDetailsResponse');
|
print('NAVuserDetails: $userDetailsResponse');
|
||||||
@ -762,7 +763,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchNotifications(locale) async {
|
Future<void> fetchNotifications(locale) async {
|
||||||
final baseUrl = apiUrl + '/api/getNotification';
|
final baseUrl = apiUrl + 'api/getNotification';
|
||||||
try {
|
try {
|
||||||
final response = await http.get(Uri.parse('$baseUrl?language=$locale'),
|
final response = await http.get(Uri.parse('$baseUrl?language=$locale'),
|
||||||
headers: {'APP_SIGNATURE': 'fcsc.gov.ae.X7pL9qZm2A'});
|
headers: {'APP_SIGNATURE': 'fcsc.gov.ae.X7pL9qZm2A'});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user