File size: 1,066 Bytes
7fc5208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { API_BASE_URL, getHeaders, handleResponse } from './util';

export interface Settings {
    /** 飞书配置 */
    feishu: {
        /** 飞书应用ID */
        app_id: string;
        /** 飞书应用密钥 */
        app_secret: string;
        /** 飞书应用验证Token */
        verification_token: string;
        /** 飞书应用加密Key */
        encrypt_key: string;
        /** 飞书机器人接收ID */
        receive_id: string;
    }
}


export const settingApi = {
    async update(settings: Settings) {
        const response = await fetch(
            `${API_BASE_URL}/api/setting`,
            {
                headers: getHeaders(),
                method: 'POST',
                body: JSON.stringify(settings)
            }
        );
        return handleResponse(response);
    },

    async get(): Promise<Settings> {
        const response = await fetch(
            `${API_BASE_URL}/api/setting`,
            {
                headers: getHeaders()
            }
        );
        return handleResponse(response);
    },
}