-
Notifications
You must be signed in to change notification settings - Fork 8.4k
/
tag.ts
47 lines (41 loc) · 995 Bytes
/
tag.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { del, get, patch, post } from './base'
import type { Tag } from '@/app/components/base/tag-management/constant'
export const fetchTagList = (type: string) => {
return get<Tag[]>('/tags', { params: { type } })
}
export const createTag = (name: string, type: string) => {
return post<Tag>('/tags', {
body: {
name,
type,
},
})
}
export const updateTag = (tagID: string, name: string) => {
return patch(`/tags/${tagID}`, {
body: {
name,
},
})
}
export const deleteTag = (tagID: string) => {
return del(`/tags/${tagID}`)
}
export const bindTag = (tagIDList: string[], targetID: string, type: string) => {
return post('/tag-bindings/create', {
body: {
tag_ids: tagIDList,
target_id: targetID,
type,
},
})
}
export const unBindTag = (tagID: string, targetID: string, type: string) => {
return post('/tag-bindings/remove', {
body: {
tag_id: tagID,
target_id: targetID,
type,
},
})
}