PageSourceSearch

https://www.arda.or.th/assets/api/connect/connectfront.js?v=1783622125

js arda.or.th collected 2026-10-02 10:50:25 UTC 4,355 bytes, 119 lines download raw bytes

1const Api = (() => {
2    function initial(method = "GET") {
3        return {
4            method: method,
5            headers: {
6                Accept: "application/json",
7                "Content-Type": "application/json",
8            },
9        };
10    }
11    return {
12        async get(url) {
13            let init = initial("GET");
14            let response = await fetch(url, init);
15            let result = await response.json();
16            if (result.errorCode === undefined) {
17                throw "มีบางอย่างผิดพลาด";
18            }
19            if (result.errorCode == 100) {
20                window.location.href = "/admin/login";
21                return null;
22            }
23            if (result.errorCode !== 0) {
24                throw result.errorMessage;
25            }
26            return result?.data ?? [];
27        },
28        async delete(url) {
29            let token = $("#token").val();
30            let init = initial("DELETE");
31            init.headers["X-CSRF-TOKEN"] = token;
32            let response = await fetch(url, init);
33            let result = await response.json();
34            if (result.errorCode === undefined) {
35                throw "มีบางอย่างผิดพลาด";
36            }
37            if (result.errorCode == 100) {
38                window.location.href = "/admin/login";
39                return null;
40            }
41            if (result.errorCode !== 0) {
42                throw result.errorMessage;
43            }
44            return result;
45        },
46        async post(url, data) {
47            let token = $("#token").val();
48            let init = initial("POST");
49            init.headers["X-CSRF-TOKEN"] = token;
50            init.body = JSON.stringify(data);
51            let response = await fetch(url, init);
52            let result = await response.json();
53            if (result.errorCode === undefined) {
54                throw "มีบางอย่างผิดพลาด";
55            }
56            if (result.errorCode == 100) {
57                window.location.href = "/admin/login";
58                return null;
59            }
60            if (result.errorCode !== 0) {
61                throw result.errorMessage;
62            }
63            return result;
64        },
65        async postFormdata(url, data) {
66            let init = initial("POST");
67            delete init.headers["Content-Type"];
68            console.log(init);
69            init.headers["X-CSRF-TOKEN"] = $("#token").val();
70            init.body = data;
71            let response = await fetch(url, init);
72            let result = await response.json();
73            if (result.errorCode === undefined) {
74                throw "มีบางอย่างผิดพลาด";
75            }
76            if (result.errorCode == 100) {
77                window.location.href = "/admin/login";
78                return null;
79            }
80            if (result.errorCode !== 0) {
81                throw result.errorMessage;
82            }
83            return result;
84        },
85        async createMenu(data) {
86            return await this.post("/api/menu/create", data);
87        },
88        async updateSortMenu(data) {
89            return await this.post("/api/menu/sort-menu", data);
90        },
91        async editMenu(ID, data) {
92            return await this.post(`/api/menu/${ID}`, data);
93        },
94        async getMenu() {
95            return await this.get(`/api/menu/navbar`);
96        },
97        async getMenuByID(id) {
98            return await this.get(`/api/menu/${id}`);
99        },
100        async getAllArdaNews() {
101            return await this.get(`/api/menu/all/arda-news/`);
102        },
103        async getPageWithType(type, language) {
104            return await this.get(`/api/menu/${language ? language : 'TH'}/pageByType/${type}`);
105        },
106        async deleteMenuByID(id) {
107            return await this.delete(`/api/menu/${id}`);
108        },
109        async getRole() {
110            return await this.get(`/api/role`);
111        },
112        async getRoleByID(id) {
113            return await this.get(`/api/role/${id}`);
114        },
115        async deleteRoleByID(id, token) {
116            return await this.delete(`/api/role/${id}`, token);
117        },
118    };
119})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.