mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-10 03:27:54 +00:00
feat(namespace): add batchAddMembers API client method
This commit is contained in:
parent
0da51a63ea
commit
4b538bde04
1 changed files with 11 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ import type {
|
|||
AdminLabelInput,
|
||||
LabelDefinition,
|
||||
LabelItem,
|
||||
BatchMemberResponse,
|
||||
} from './types'
|
||||
import { ApiError } from '@/shared/lib/api-error'
|
||||
import i18n from '@/i18n/config'
|
||||
|
|
@ -702,6 +703,16 @@ export const namespaceApi = {
|
|||
})
|
||||
},
|
||||
|
||||
async batchAddMembers(slug: string, members: Array<{ userId: string; role: string }>): Promise<BatchMemberResponse> {
|
||||
return fetchJson<BatchMemberResponse>(`${WEB_API_PREFIX}/namespaces/${normalizeNamespaceSlug(slug)}/members/batch`, {
|
||||
method: 'POST',
|
||||
headers: await ensureCsrfHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: JSON.stringify({ members }),
|
||||
})
|
||||
},
|
||||
|
||||
async updateMemberRole(slug: string, userId: string, role: string): Promise<NamespaceMember> {
|
||||
return fetchJson<NamespaceMember>(
|
||||
`${WEB_API_PREFIX}/namespaces/${normalizeNamespaceSlug(slug)}/members/${encodeURIComponent(userId)}/role`,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue