File size: 620 Bytes
c40c75a
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { teamListCall, DEFAULT_ORGANIZATION, Organization } from "../networking";

export const fetchTeams = async (accessToken: string, userID: string | null, userRole: string | null, currentOrg: Organization | null, setTeams: (teams: any[]) => void) => {
    let givenTeams;
    if (userRole != "Admin" && userRole != "Admin Viewer") {
      givenTeams = await teamListCall(accessToken, currentOrg?.organization_id || null, userID)
    } else {
      givenTeams = await teamListCall(accessToken, currentOrg?.organization_id || null)
    }
    
    console.log(`givenTeams: ${givenTeams}`)

    setTeams(givenTeams)
  }