ide-assi 0.173.0 → 0.175.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/components/ideAssi.js +1 -1
- package/dist/components/ideFetch.js +41 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/src/components/ideAssi.js +1 -1
- package/src/components/ideFetch.js +41 -0
- package/src/index.js +1 -0
package/dist/bundle.cjs.js
CHANGED
|
@@ -193726,7 +193726,7 @@ class IdeAssi extends HTMLElement
|
|
|
193726
193726
|
};
|
|
193727
193727
|
|
|
193728
193728
|
#config = async () => {
|
|
193729
|
-
const res = await fetch(`/api/
|
|
193729
|
+
const res = await fetch(`/api/config/get`, {
|
|
193730
193730
|
method: "POST",
|
|
193731
193731
|
headers: {"Content-Type": "application/json"},
|
|
193732
193732
|
});
|
package/dist/bundle.esm.js
CHANGED
|
@@ -193722,7 +193722,7 @@ class IdeAssi extends HTMLElement
|
|
|
193722
193722
|
};
|
|
193723
193723
|
|
|
193724
193724
|
#config = async () => {
|
|
193725
|
-
const res = await fetch(`/api/
|
|
193725
|
+
const res = await fetch(`/api/config/get`, {
|
|
193726
193726
|
method: "POST",
|
|
193727
193727
|
headers: {"Content-Type": "application/json"},
|
|
193728
193728
|
});
|
|
@@ -54,7 +54,7 @@ export class IdeAssi extends HTMLElement
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
#config = async () => {
|
|
57
|
-
const res = await fetch(`/api/
|
|
57
|
+
const res = await fetch(`/api/config/get`, {
|
|
58
58
|
method: "POST",
|
|
59
59
|
headers: {"Content-Type": "application/json"},
|
|
60
60
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export class IdeFetch {
|
|
2
|
+
static baseUrl = "/api";
|
|
3
|
+
|
|
4
|
+
static #request = (method, url, data = {}) => {
|
|
5
|
+
|
|
6
|
+
console.log(method, url, data);
|
|
7
|
+
|
|
8
|
+
const fullUrl = method === "GET"
|
|
9
|
+
? `${IdeFetch.baseUrl}/${url}?${new URLSearchParams(data)}`
|
|
10
|
+
: `${IdeFetch.baseUrl}/${url}`;
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
method,
|
|
14
|
+
headers: { "Content-Type": "application/json" }
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
if (method !== "GET") {
|
|
18
|
+
options.body = JSON.stringify(data);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return fetch(fullUrl, options)
|
|
22
|
+
.then(res => {
|
|
23
|
+
if (!res.ok) {
|
|
24
|
+
return res.text().then(text => {
|
|
25
|
+
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return res.json();
|
|
29
|
+
})
|
|
30
|
+
.catch(err => {
|
|
31
|
+
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
32
|
+
throw err;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
37
|
+
|
|
38
|
+
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const api = IdeFetch;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -54,7 +54,7 @@ export class IdeAssi extends HTMLElement
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
#config = async () => {
|
|
57
|
-
const res = await fetch(`/api/
|
|
57
|
+
const res = await fetch(`/api/config/get`, {
|
|
58
58
|
method: "POST",
|
|
59
59
|
headers: {"Content-Type": "application/json"},
|
|
60
60
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export class IdeFetch {
|
|
2
|
+
static baseUrl = "/api";
|
|
3
|
+
|
|
4
|
+
static #request = (method, url, data = {}) => {
|
|
5
|
+
|
|
6
|
+
console.log(method, url, data);
|
|
7
|
+
|
|
8
|
+
const fullUrl = method === "GET"
|
|
9
|
+
? `${IdeFetch.baseUrl}/${url}?${new URLSearchParams(data)}`
|
|
10
|
+
: `${IdeFetch.baseUrl}/${url}`;
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
method,
|
|
14
|
+
headers: { "Content-Type": "application/json" }
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
if (method !== "GET") {
|
|
18
|
+
options.body = JSON.stringify(data);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return fetch(fullUrl, options)
|
|
22
|
+
.then(res => {
|
|
23
|
+
if (!res.ok) {
|
|
24
|
+
return res.text().then(text => {
|
|
25
|
+
throw new Error(`API 오류 (${res.status}): ${text}`);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return res.json();
|
|
29
|
+
})
|
|
30
|
+
.catch(err => {
|
|
31
|
+
console.error(`[fetch.${method.toLowerCase()}] ${url} 실패:`, err);
|
|
32
|
+
throw err;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
static get = (url, data = {}) => IdeFetch.#request("GET", url, data);
|
|
37
|
+
|
|
38
|
+
static post = (url, data = {}) => IdeFetch.#request("POST", url, data);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const api = IdeFetch;
|