Merge branch 'family_banner_reload' of WrenchBoard/Users-Wrench into master

This commit is contained in:
2024-11-29 15:30:44 +00:00
committed by Gogs
5 changed files with 15 additions and 5 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ export default function Routers() {
<Route path="/complereset" element={<VerifyPasswordPagesTwo />} />
<Route exact path="/outmessage" element={<VerifyYouPagesTwo />} />
<Route exact path="/eoffer" element={<LoginPageTwo />} />
<Route exact path="/invite" element={<LoginPageTwo />} />
<Route exact path="/invite" element={<SignupPageTwo />} />
<Route exact path="/promo/:name/:id" element={<PromoPage />} />
</>
) : (
@@ -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
+3 -2
View File
@@ -74,7 +74,7 @@ function ReferralDisplay() {
};
//FUNCTION TO SEND REFERRAL MESSAGE
const sendReferralMsg = (postData) => {
const sendReferralMsg = (postData, helpers) => {
apiCall
.sendReferralMsg(postData)
.then((res) => {
@@ -90,6 +90,7 @@ function ReferralDisplay() {
} else {
// toast.success(res.data.status | "Message Sent!");
setError({ message: res.data.status, loading: false, status: true });
helpers.resetForm() // resets the form data
setRefHistoryReload((prev) => !prev);
setTimeout(()=>{
setError({ message: '', loading: false, status: true });
@@ -111,7 +112,7 @@ function ReferralDisplay() {
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = (values, helpers) => {
setError({ message: "", loading: true, status: false });
sendReferralMsg({...values}); // FUNCTION TO SEND REFERRAL MESSAGE
sendReferralMsg({...values}, helpers); // FUNCTION TO SEND REFERRAL MESSAGE
};
const [selectedTab, setSelectedTab] = useState("Send Referral");
+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());
@@ -91,6 +93,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
}
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 });
@@ -99,6 +102,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
}
}, []);
@@ -269,8 +273,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);
}