50 lines
1.8 KiB
Swift
50 lines
1.8 KiB
Swift
//
|
|
// CommonNwCall.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 13/06/24.
|
|
//
|
|
|
|
import UIKit
|
|
import Alamofire
|
|
|
|
//class CommonNwCall{
|
|
//
|
|
// static let shareInstance = CommonNwCall()
|
|
// var userNotification = [UserNotificationDM]()
|
|
//
|
|
// func getUserNotification(vc : UIViewController , isRefreshing : Bool? = nil, completion : @escaping (Bool) -> Void){
|
|
// if isRefreshing == false || isRefreshing == nil{
|
|
// Utilities.startProgressHUD()
|
|
// }
|
|
// let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()]
|
|
// NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.get_user_notifications, method: .get,headers : headers) {(result : Result<BaseResponseModel<[UserNotificationDM]>, NetworkManager.APIError>) in
|
|
// switch result{
|
|
// case .success(let data):
|
|
// switch data.success{
|
|
// case 0:
|
|
// /*
|
|
// Error
|
|
// */
|
|
// Utilities.dismissProgressHUD()
|
|
// vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
|
|
// completion(false)
|
|
// case 1:
|
|
// Utilities.dismissProgressHUD()
|
|
// guard let data = data.data else{return}
|
|
// self.userNotification.removeAll()
|
|
// self.userNotification.append(contentsOf: data)
|
|
// //Fetched Blogs
|
|
// completion(true)
|
|
// default:
|
|
// completion(false)
|
|
// }
|
|
// case .failure(let error):
|
|
// Utilities.dismissProgressHUD()
|
|
// vc.toast(msg: error.localizedDescription , time: 2)
|
|
// completion(false)
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|