star-tag.ts
1.09 KB
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
import { AnyObject, QueryForParams, ServiceResponse } from '@/types/global';
import { Tag } from '@/types/star-tags';
import axios from 'axios';
export default class useTagApi {
static frameOption = [
{ label: '需要边框', value: 1 },
{ label: '不需要边框', value: 2 },
];
static indexFilterOption = [
{ label: '首页可筛选', value: 1 },
{ label: '首页不可筛选', value: 0 },
];
static statusOption = [
{ label: '开启', value: 1 },
{ label: '禁用', value: 0 },
];
static async get(params?: QueryForParams): Promise<ServiceResponse<Tag[]>> {
return axios.get('system/user_tags', { params });
}
static async create(data: AnyObject): Promise<Tag> {
return axios.post('system/user_tags', data).then((res) => Promise.resolve(res.data));
}
static async update(id: number, data: AnyObject): Promise<Tag> {
return axios.put(`system/user_tags/${id}`, data).then((res) => Promise.resolve(res.data));
}
static async destroy(id: number) {
return axios.delete(`system/user_tags/${id}`).then((res) => Promise.resolve(res.data));
}
}