From 1e510c6b84a3936c65348ec0a3337ece99da925e Mon Sep 17 00:00:00 2001 From: Hari Krishna Date: Sat, 24 Feb 2024 11:37:36 +0000 Subject: [PATCH] Added a way to get the sub orgs of the current org --- backend/go-app/main.go | 1 + frontend/src/views/Admin.jsx | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/backend/go-app/main.go b/backend/go-app/main.go index b2e901d5..8b4264d5 100755 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -4923,6 +4923,7 @@ func initHandlers() { r.HandleFunc("/api/v1/orgs/{orgId}/change", shuffle.HandleChangeUserOrg).Methods("POST", "OPTIONS") // Swaps to the org r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleDeleteOrg).Methods("DELETE", "OPTIONS") + r.HandleFunc("/api/v1/subOrg/{orgId}", shuffle.HandleGetSubOrg).Methods("GET", "OPTIONS") // This is a new API that validates if a key has been seen before. // Not sure what the best course of action is for it. diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index e6dc8bc0..674eaeb0 100755 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -162,6 +162,7 @@ const Admin = (props) => { const [loginInfo, setLoginInfo] = React.useState(""); const [curTab, setCurTab] = React.useState(0); const [users, setUsers] = React.useState([]); + const [subOrgs, setSubOrgs] = useState([]); const [organizations, setOrganizations] = React.useState([]); const [orgSyncResponse, setOrgSyncResponse] = React.useState(""); const [userSettings, setUserSettings] = React.useState({}); @@ -204,6 +205,10 @@ const Admin = (props) => { } }, [isDropzone]); + useEffect(() => { + handleGetSubOrgs(userdata.active_org.id); + }, []); + const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io"; const get2faCode = (userId) => {