delete and send reminder API added
This commit is contained in:
@@ -6,8 +6,7 @@ import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
||||
|
||||
function SendReminderModal({ details, onClose, situation }) {
|
||||
console.log('details',details)
|
||||
function SendReminderModal({ details, onClose, situation, setReloadList }) {
|
||||
let dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const ApiCall = new usersService();
|
||||
@@ -20,10 +19,33 @@ function SendReminderModal({ details, onClose, situation }) {
|
||||
|
||||
// FUNCTION TO SEND REMINDER
|
||||
const sendReminder = () => {
|
||||
setRequestStatus(prev => ({...prev, loading:true, message: 'No API Yet'}))
|
||||
setTimeout(()=>{
|
||||
setRequestStatus(prev => ({...prev, loading:false, message: ''}))
|
||||
},3000)
|
||||
setRequestStatus({loading:true, status:false, message: ''})
|
||||
|
||||
let reqData = { // REQUEST PAYLOAD
|
||||
suggest_uid: details.uid,
|
||||
suggest_action: 222,
|
||||
offset: 0
|
||||
}
|
||||
ApiCall.suggestStatus(reqData).then((response)=>{ // API CALL TO DELETE SUGGESTED TASK
|
||||
let {data} = response
|
||||
if(data.internal_return < 0){
|
||||
setRequestStatus({loading:false, status:false, message: 'Unable to send reminder, Try again1111'})
|
||||
return setTimeout(()=>{
|
||||
setRequestStatus({loading:false, status:false, message: ''})
|
||||
},3000)
|
||||
}
|
||||
setRequestStatus({loading:false, status:true, message: 'Reminder Sent'})
|
||||
setReloadList(prev => !prev) // RELOADS THE FAMILY SUGGEST LIST TABLE
|
||||
setTimeout(()=>{
|
||||
setRequestStatus({loading:false, status:false, message: ''})
|
||||
onClose()
|
||||
},3000)
|
||||
}).catch(error => {
|
||||
setRequestStatus({loading:false, status:false, message: 'Unable to send reminder, Try againNETWORK'})
|
||||
setTimeout(()=>{
|
||||
setRequestStatus({loading:false, status:false, message: ''})
|
||||
},3000)
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -90,7 +112,7 @@ function SendReminderModal({ details, onClose, situation }) {
|
||||
>
|
||||
<span className="text-gradient">Cancel</span>
|
||||
</button> */}
|
||||
{requestStatus.laoding ? (
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user