Merge branch 'main' into splash
This commit is contained in:
@@ -3,10 +3,15 @@ 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 {
|
||||
final response = await NetworkApiServices().getApi(
|
||||
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());
|
||||
@@ -22,4 +27,27 @@ class FAQApi {
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user