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.
20 lines
532 B
20 lines
532 B
import { fetch } from './fetch'
|
|
import { Entity } from '../types'
|
|
|
|
interface GroupsResponse {
|
|
groups: Entity[]
|
|
continuation?: string
|
|
}
|
|
|
|
export async function getGroups(sort: string = 'members', continuation?: string) {
|
|
const params = {
|
|
sort,
|
|
continuation,
|
|
}
|
|
|
|
const querystring = Object.entries(params).filter(([name, value]) => value !== undefined).map(([name, value]) => `${name}=${value}`).join('&')
|
|
|
|
return await fetch<GroupsResponse>({
|
|
path: `/api/groups?${querystring}`
|
|
})
|
|
}
|