Files
Regroup/lib/Feed Module/Main_Screens/ProfileTab/Settings/ViewModel/NotificationApi.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/Feed%20Module/Main_Screens/ProfileTab/Settings/Model/FetchNotification.dart';
FetchNotification? fetchNoti;
class NotificationAPI {
NotificationAPI();
// class otpAPI {
// otpAPI(this.data);
// var data;
Future<ResponseData<dynamic>> notificationPostApi(var data) async {
final response = await NetworkApiServices().postApi(
data,
ApiUrls.postnotification,
// "https://regroup.betadelivery.com/api/v1/forgot-password",
);
if (response.status == ResponseStatus.SUCCESS) {
//Map<String, dynamic> responseData = jsonDecode(response.data);
if (response.data['status'] == "success") {
return ResponseData<dynamic>(
response.data['message'], ResponseStatus.SUCCESS,
// data: response.data
);
} else {
return ResponseData<dynamic>(
response.data['message'], ResponseStatus.FAILED);
}
}
return response;
}
Future<ResponseData<dynamic>> getNotification() async {
final response = await NetworkApiServices().getApi(
ApiUrls.getnotification,
);
fetchNoti = FetchNotification.fromJson(response.data);
if (response.status == ResponseStatus.SUCCESS) {
if (response.data["status"] == "success") {
return ResponseData<dynamic>(
response.data['message'], ResponseStatus.SUCCESS,
data: response.data);
} else {
return ResponseData<dynamic>(
response.data['message'], ResponseStatus.FAILED);
}
}
return response;
}
}