diff --git a/src/components/Home/FamilyDash.jsx b/src/components/Home/FamilyDash.jsx index b6839d5..b367d95 100644 --- a/src/components/Home/FamilyDash.jsx +++ b/src/components/Home/FamilyDash.jsx @@ -18,6 +18,8 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) { const { familyBannersList } = useSelector((state) => state.familyBannersList); + const { familyResources:{ tab_categories } } = useSelector((state) => state.familyResources); + const { userDetails } = useSelector((state) => state?.userDetails); let [reloadBanner, setReloadBanner] = useState(0) @@ -61,12 +63,11 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) { {/* */} {/* Header */} -
-
+
+

Welcome

-
-

{`${userDetails?.firstname} ${userDetails?.lastname}`}

-

Email

+
+

{`${userDetails?.firstname} ${userDetails?.lastname}`}

@@ -87,12 +88,10 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) {
banner image
-
+

{content.banner.text}

{content.banner.description}

- {/* Horizontal Line */} - {/*
*/}
6w ago @@ -111,36 +110,39 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) {
} + {tab_categories?.data &&

Resources

- {[1,2,3,4,5].map((item, index) => ( - -
- banner image -
-
-

{'Heading'}

-

{'Description'}

-
- {/* Horizontal Line */} - {/*
*/} + {tab_categories.data.map((item) => { + if(item.enabled){ + return ( + +
+ banner image +
+
+

{item?.content}

+ {/*

{'Description'}

*/} +
-
- 6w ago - {/* Dots */} -
-
-
-
+
+ 6w ago + {/* Dots */} +
+
+
+
+
-
- - ))} + + )} + })}
+ } } diff --git a/src/lib/apiConst.js b/src/lib/apiConst.js index 58f3375..9512810 100644 --- a/src/lib/apiConst.js +++ b/src/lib/apiConst.js @@ -133,6 +133,7 @@ export const apiConst = { WRENCHBOARD_ACCOUNT_HOMEBANNERS: 11200, WRENCHBOARD_ACCOUNT_PLAYGROUND: 11201, WRENCHBOARD_ACCOUNT_FAMILY_BANNERS: 22005, + WRENCHBOARD_ACCOUNT_FAMILY_RESOURCES: 22017, WRENCHBOARD_ACCOUNT_RECENTS: 11202, WRENCHBOARD_ACCOUNT_NOTIFICATIONS: 11205, diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx index 200193f..b308721 100644 --- a/src/middleware/AuthRoute.jsx +++ b/src/middleware/AuthRoute.jsx @@ -12,6 +12,7 @@ import { updateNotifications } from "../store/notifications"; import { updateUserJobList } from "../store/userJobList"; import { updateWalletDetails } from "../store/walletDetails"; import { familyBannersList } from "../store/FamilyBannerList"; +import { familyResources } from "../store/FamilyResources"; const AuthRoute = ({ redirectPath = "/login", children }) => { const apiCall = useMemo(() => new usersService(), []); @@ -271,6 +272,23 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { getFamilyBanners() }, [isLogin.status, familyBannersListTable]); + //FUNCTION TO GET FAMILY RESOURCES + useEffect(() => { + if((!loggedIn && !isLogin.status) || account_type == 'FULL'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FULL + return + } + const getFamilyResourcesList = async () => { // FUNCTION TO GET FAMILY BANNERS + try { + const res = await apiCall.getFamilyResources(); + dispatch(familyResources(res?.data?.result_list)) + // console.log('RESPONSE', res?.data?.result_list) + } catch (error) { + console.log("Error getting tasks"); + } + }; + getFamilyResourcesList() + }, [isLogin.status, familyBannersListTable]); + // useEffect(() => { // apiCall // .getHeroJBanners() diff --git a/src/services/UsersService.js b/src/services/UsersService.js index 1ed6f1c..903f6ab 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -1245,11 +1245,11 @@ class usersService { member_id: localStorage.getItem("member_id"), sessionid: localStorage.getItem("session_token"), action: apiConst.WRENCHBOARD_RELATIVE_INVITE, - ...reqData + ...reqData, }; return this.postAuxEnd("/familyrelinvite", postData); } - + // API FUNCTION TO FAMILY BANNERS getFamilyBannersList() { var postData = { @@ -1258,10 +1258,23 @@ class usersService { sessionid: localStorage.getItem("session_token"), action: apiConst.WRENCHBOARD_ACCOUNT_FAMILY_BANNERS, limit: 20, - offset: 1 + offset: 1, }; return this.postAuxEnd("/familybanners", postData); } + + // API FUNCTION TO FAMILY RESOURCES + getFamilyResources() { + var postData = { + uid: localStorage.getItem("uid"), + member_id: localStorage.getItem("member_id"), + sessionid: localStorage.getItem("session_token"), + action: apiConst.WRENCHBOARD_ACCOUNT_FAMILY_RESOURCES, + limit: 20, + offset: 1, + }; + return this.postAuxEnd("/familyresources", postData); + } /* - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username) - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password) diff --git a/src/store/FamilyResources.js b/src/store/FamilyResources.js new file mode 100644 index 0000000..e4e9359 --- /dev/null +++ b/src/store/FamilyResources.js @@ -0,0 +1,20 @@ +import { createSlice } from "@reduxjs/toolkit"; + +const initialState = { + familyResources: {} +}; + +export const familyResourcesSlice = createSlice({ + name: "familyResources", + initialState, + reducers: { + familyResources: (state,action) => { + state.familyResources = {...action.payload} + }, + }, +}); + +// Action creators are generated for each case reducer function +export const { familyResources } = familyResourcesSlice.actions; + +export default familyResourcesSlice.reducer; \ No newline at end of file diff --git a/src/store/store.js b/src/store/store.js index 0becfb2..37708bf 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -9,6 +9,7 @@ import notificationsReducer from "./notifications"; import userJobListReducer from "./userJobList"; import walletDetails from "./walletDetails"; import familyBannerListReducer from "./FamilyBannerList" +import familyResourcesReducer from './FamilyResources' export default configureStore({ reducer: { @@ -20,6 +21,7 @@ export default configureStore({ commonHeadBanner: commonHeadBannerReducer, notifications: notificationsReducer, walletDetails: walletDetails, - familyBannersList: familyBannerListReducer + familyBannersList: familyBannerListReducer, + familyResources: familyResourcesReducer }, });