This repository has been archived on 2025-11-04. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
know-it-all/client/src/components/orgs/OwnedOrgs.jsx

33 lines
904 B
JavaScript

import React from 'react';
import axios from 'axios';
import Cookies from 'js-cookie';
import Organizations from '../utils/Organizations';
function JoinedOrgs() {
async function getOrgs(setOrgs) {
axios
.get(
`${process.env.REACT_APP_API_ROOT}/auth?token=${Cookies.get(
'token'
)}`
)
.then((response) => {
setOrgs(() =>
response.data.map((org) => {
return {
orgID: org.orgID,
orgName: org.orgName,
memberCount: org.memberCount,
createdAt: org.createdAt,
};
})
);
});
}
return <Organizations retrieveOrgs={getOrgs} />;
}
export default JoinedOrgs;