Skip to content

Commit

Permalink
FIX: admin get for admin in the nested route of admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Same-kotto authored and Maxime Same-kotto committed Jan 4, 2024
1 parent 0c2a191 commit 6619525
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/view/Admin/OrganisationUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import { API_URL } from "../../config/API";
import UsersTable from "../../component/UserTable";
import { AuthContext } from "../../services/AuthProvider";
import { AdminSideBar } from "../../component/admin/SideBar";
import { useParams } from "react-router-dom";

export default function AdminOrganisationUsers() {
const theme = useTheme();
const [IsSetup, setIsSetup] = useState(false);
const params = useParams();
const [users, setUsers] = useState([]);
const [organisations, setOrganisations] = useState([]);

Expand All @@ -22,16 +24,17 @@ export default function AdminOrganisationUsers() {
useEffect(() => {
const init = async () => {
try {
let userRes = await axios.get(`${API_URL}/api/accounts/admin`, {
let userRes = await axios.get(`${API_URL}/api/organisations/${params.id}`, {
headers: {
Authorization: `Bearer ${token}`,
},
});

setUsers(userRes.data);
} catch (e) {
logout();
window.location.replace("/");
console.log(e)
//logout();
//window.location.replace("/");
}

let orgRes = await axios.get(`${API_URL}/api/organisations`, {
Expand Down

0 comments on commit 6619525

Please sign in to comment.