diff --git a/client/src/components/table/Table.js b/client/src/components/table/Table.js index 0389777..042f92d 100644 --- a/client/src/components/table/Table.js +++ b/client/src/components/table/Table.js @@ -11,8 +11,8 @@ const Table = () => { const [members, setMembers] = useState([]); useEffect(() => { const getAllMembers = async () => { - const allMembers = await getMembers() - setMembers(allMembers) + const allMembers = await getMembers(); + setMembers(allMembers.data.result); }; getAllMembers(); }, []); diff --git a/client/src/utils/apiWrapper.js b/client/src/utils/apiWrapper.js index b8f8293..29c2cae 100644 --- a/client/src/utils/apiWrapper.js +++ b/client/src/utils/apiWrapper.js @@ -95,6 +95,21 @@ export const getMemberSchemaTypes = () => { })); }; +// Retrieves all members +export const getMembers = () => { + const requestString = `${BACKEND_BASE_URL}/members`; + return axios + .get(requestString, { + headers: { + 'Content-Type': 'application/JSON', + }, + }) + .catch((error) => ({ + type: 'GET_MEMBERS_FAIL', + error, + })); +}; + // Retrieves a member's permissions from their mongo ID export const updateMember = (member, memberID) => { const requestString = `${BACKEND_BASE_URL}/members/${memberID}`;