55 lines
1.7 KiB
Dart
55 lines
1.7 KiB
Dart
import 'package:regroup/Common/api_urls.dart';
|
|
import 'package:regroup/Common/base_manager.dart';
|
|
import 'package:regroup/Common/controller/data/network/network_api.dart';
|
|
import 'package:regroup/sidemenu/Community/MyCommunity/Model/ComDetailModel.dart';
|
|
import 'package:regroup/sidemenu/Community/MyCommunity/Model/ComPostModel.dart';
|
|
|
|
ComDetailModel? comdetailobj;
|
|
ComPostModel? compostobj;
|
|
|
|
class CommunityDetail {
|
|
|
|
Future<ResponseData<dynamic>> getCommunityDetail(updata) async {
|
|
final response =
|
|
await NetworkApiServices().getApi(
|
|
"${ApiUrls.getcommunitydetail}?id=$updata",
|
|
|
|
);
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
comdetailobj = ComDetailModel.fromJson(response.data);
|
|
|
|
}
|
|
return response;
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> getComPostApi(updata) async {
|
|
final response = await NetworkApiServices().getApi(
|
|
|
|
"${ApiUrls.getComPostdetail}?manage_community_xid=$updata"
|
|
);
|
|
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
if (response.data["status"] == "success") {
|
|
compostobj = ComPostModel.fromJson(response.data);
|
|
}
|
|
return ResponseData<dynamic>(
|
|
response.data['message'], ResponseStatus.SUCCESS,
|
|
data: response.data);
|
|
} else {
|
|
return ResponseData<dynamic>(
|
|
response.data['message'], ResponseStatus.FAILED);
|
|
}
|
|
}
|
|
|
|
Future<ResponseData<dynamic>> postLeaveCommunity(updata, comId) async {
|
|
final response = await NetworkApiServices().postApi(
|
|
updata,
|
|
"${ApiUrls.postleavecommunity}?manage_community_xid=$comId",
|
|
);
|
|
if (response.status == ResponseStatus.SUCCESS) {
|
|
|
|
}
|
|
return response;
|
|
}
|
|
} |