You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
551 B
18 lines
551 B
import { createContext, useContext } from 'react' |
|
|
|
export interface GroupListContextType { |
|
userGroups: string[] |
|
isUserInGroup: (groupId: string) => boolean |
|
refreshGroupList: () => Promise<void> |
|
isLoading: boolean |
|
} |
|
|
|
export const GroupListContext = createContext<GroupListContextType | undefined>(undefined) |
|
|
|
export const useGroupList = (): GroupListContextType => { |
|
const context = useContext(GroupListContext) |
|
if (context === undefined) { |
|
throw new Error('useGroupList must be used within a GroupListProvider') |
|
} |
|
return context |
|
}
|
|
|