54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import 'dart:developer';
|
|
|
|
import '../../Utils/api_urls.dart';
|
|
import '../../Utils/base_manager.dart';
|
|
import '../../data/network/network_api_services.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
class FAQApi {
|
|
Future<ResponseData<dynamic>> getFAQData() async {
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
String? token = prefs.getString('accessToken');
|
|
|
|
final response = await NetworkApiServices().postApi(
|
|
token == null || token.isEmpty ? {} : {"token": token},
|
|
ApiUrls.faqApi,
|
|
);
|
|
log(response.data.toString());
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
Map<String, dynamic> responseData =
|
|
Map<String, dynamic>.from(response.data);
|
|
if (responseData['status'] == "success") {
|
|
return response;
|
|
} else {
|
|
return ResponseData<dynamic>(
|
|
responseData['message'], ResponseStatus.FAILED);
|
|
}
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> updaeFAQLikeDisklikeData(
|
|
int faqId, int status) async {
|
|
final response = await NetworkApiServices().postApi(
|
|
{
|
|
"faq_id": faqId,
|
|
"status": status,
|
|
},
|
|
ApiUrls.faqLikeDislikeApi,
|
|
);
|
|
log(response.data.toString());
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
Map<String, dynamic> responseData =
|
|
Map<String, dynamic>.from(response.data);
|
|
if (responseData['status'] == "success") {
|
|
return response;
|
|
} else {
|
|
return ResponseData<dynamic>(
|
|
responseData['message'], ResponseStatus.FAILED);
|
|
}
|
|
}
|
|
return response;
|
|
}
|
|
}
|