Made parent family task list refresh when child accepts task
This commit was merged in pull request #651.
This commit is contained in:
@@ -10,7 +10,12 @@ import localImgLoad from "../../lib/localImgLoad";
|
||||
import { tableReload } from "../../store/TableReloads";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
||||
import { SocketValues } from "../Contexts/SocketIOContext";
|
||||
|
||||
function FamilyOfferJobPopout({ details, onClose, situation }) {
|
||||
|
||||
const {parentAssignJobToKid} = SocketValues()
|
||||
|
||||
const apiUrl = new usersService();
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
@@ -69,6 +74,18 @@ function FamilyOfferJobPopout({ details, onClose, situation }) {
|
||||
message: `Offer ${name}ed Successfully`,
|
||||
trigger: "",
|
||||
});
|
||||
// trigger socket event to refresh parent side
|
||||
//SENDS MESSAGE TO SOCKET TO UPDATE PARENT ACCOUNT WHEN CHILD ACCEPTS OR REJECTS A JOB ASSIGNED BY PARENT
|
||||
// message, room
|
||||
let socketMsg = {
|
||||
"audience": "PARENT",
|
||||
"action": "REFRESH_TASK",
|
||||
"family_uid": sessionStorage.getItem('family_uid'),
|
||||
}
|
||||
let socketRoom = `FAMILY-${sessionStorage.getItem('parent_uid')}`
|
||||
parentAssignJobToKid(socketMsg, socketRoom) //SENDS MESSAGE TO SOCKET TO UPDATE CHILD ACCOUNT
|
||||
// end of socket event trigger
|
||||
|
||||
setTimeout(() => {
|
||||
onClose();
|
||||
dispatch(tableReload({ type: "MYTASKTABLE" }));
|
||||
|
||||
Reference in New Issue
Block a user