Resoues point started

This commit is contained in:
2023-02-05 17:18:40 -05:00
parent 6f29a1f7e0
commit e15fd84676
2 changed files with 38 additions and 3 deletions
+28 -1
View File
@@ -1,4 +1,4 @@
import React, { useState } from "react"; import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import authProfilePic from "../../assets/images/auth-profile-picture.png"; import authProfilePic from "../../assets/images/auth-profile-picture.png";
import profileBanner from "../../assets/images/profile-cover.png"; import profileBanner from "../../assets/images/profile-cover.png";
@@ -13,6 +13,8 @@ import HiddenProductsTab from "./HiddenProductsTab";
import OnSaleTab from "./OnSaleTab"; import OnSaleTab from "./OnSaleTab";
import OwnTab from "./OwnTab"; import OwnTab from "./OwnTab";
import usersService from "../../services/UsersService";
export default function Resources() { export default function Resources() {
const onSaleProducts = marketPlace.data; const onSaleProducts = marketPlace.data;
const CreatedSell = marketPlace.data; const CreatedSell = marketPlace.data;
@@ -54,6 +56,31 @@ export default function Resources() {
}, },
]; ];
const api = new usersService();
const [isLoading, setIsLoading] = useState(true)
const [userResources, setUserResource] = useState([]);
const getUserResources = async () => {
try {
const res = await api.getUserResources();
// setUserResource(res.data.reminders);
setIsLoading(false)
}catch(error) {
setIsLoading(false)
}
};
useEffect(() => {
getUserResources();
}, []);
const [tab, setTab] = useState(tabs[0].name); const [tab, setTab] = useState(tabs[0].name);
const tabHandler = (value) => { const tabHandler = (value) => {
setTab(value); setTab(value);
+10 -2
View File
@@ -24,13 +24,18 @@ class usersService {
return this.getAuxEnd("/loginhx", reqData); return this.getAuxEnd("/loginhx", reqData);
} }
getUserResources(){
var reqData = {
member_id: localStorage.getItem("member_id")
};
return this.getAuxEnd("/resources", reqData);
}
//---------------------------------------- ----- //---------------------------------------- -----
//---------------------------------------- ----- //---------------------------------------- -----
// Unified call below // Unified call below
//---------------------------------------- ----- //---------------------------------------- -----
//---------------------------------------- ----- //---------------------------------------- -----
getAuxEnd(uri, reqData) { getAuxEnd(uri, reqData) {
// debugger;
const session_token = localStorage.getItem("session_token"); const session_token = localStorage.getItem("session_token");
let axiosConfig = { let axiosConfig = {
headers: { headers: {
@@ -40,7 +45,10 @@ class usersService {
} }
}; };
const endPoint = process.env.REACT_APP_USERS_ENDPOINT + uri; const endPoint = process.env.REACT_APP_USERS_ENDPOINT + uri;
return Axios.get(endPoint,axiosConfig,reqData) return Axios.get(endPoint,{
params: {
reqData
}})
.then((response) => { .then((response) => {
console.log("~~~~~~~ Toks2 GET ~~~~~~~~"); console.log("~~~~~~~ Toks2 GET ~~~~~~~~");
return response; return response;