family banner reload on parent task assignment

This commit is contained in:
victorAnumudu
2024-11-29 05:07:59 +01:00
parent 8e9ae8187f
commit 997985a45d
3 changed files with 11 additions and 2 deletions
@@ -67,6 +67,7 @@ export default function SocketIOContextProvider({children}) {
let {message} = data
if(message.action == "REFRESH_OFFER" && message.family_uid == user_uid && message.audience == "MEMBER"){ // for refreshing child account when parent assigns a job
dispatch(tableReload({type:'FAMILYOFFERLIST'})) // dispatches to update family pending/offer list on family side
dispatch(tableReload({ type: "FAMILYBANNERSLIST" })) // dispatches to update family banner list on family side
}
if(message.action == "REFRESH_TASK" && message.audience == "PARENT"){ // for refreshing parent account when child accepts or rejects a job
dispatch(tableReload({type:'PARENTFAMILYTASKLIST'})) // dispatches to update parent family task list on parent side
+8 -1
View File
@@ -20,6 +20,8 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
let {joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
const [nocache, setNoCache] = useState(false) // holds cache/nocache value
const apiCall = useMemo(() => new usersService(), []);
const dispatch = useDispatch();
const [lastActivityTime, setLastActivityTime] = useState(Date.now());
@@ -100,6 +102,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
setLoadProfileDetails(res.data);
dispatch(updateUserDetails({ ...res.data }));
setIsLogin({ loading: false, status: true });
setNoCache(true) // Sets no cache to true, so as to trigger nocache whenever used in api call
})
.catch((error) => {
setIsLogin({ loading: false, status: false });
@@ -108,6 +111,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
loadProfile();
}else{
setIsLogin({ loading: false, status: true });
setNoCache(true) // Sets no cache to true, so as to trigger nocache whenever used in api call
}
}, []);
@@ -280,8 +284,11 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
}
const getFamilyBanners = async () => { // FUNCTION TO GET FAMILY BANNERS
// setFamilyBannersList({loading:true, result:[]});
dispatch(familyBannersList({loading:true}))
const noCache = (isLogin.status && nocache )? 1 : 0
const reqData = {nocache: noCache}
try {
const res = await apiCall.getFamilyBannersList();
const res = await apiCall.getFamilyBannersList(reqData);
dispatch(familyBannersList({...res?.data, loading:false}))
} catch (error) {
dispatch(familyBannersList({loading:false}))
+2 -1
View File
@@ -1396,7 +1396,7 @@ class usersService {
}
// API FUNCTION TO FAMILY BANNERS
getFamilyBannersList() {
getFamilyBannersList(reqData) {
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
@@ -1404,6 +1404,7 @@ class usersService {
action: apiConst.WRENCHBOARD_ACCOUNT_FAMILY_BANNERS,
limit: 20,
offset: 1,
...reqData
};
return this.postAuxEnd("/familybanners", postData);
}