@ywfe/fe-tools 1.2.1-beta.32 → 1.2.1-beta.34
Sign up to get free protection for your applications and to get access to all the features.
- package/JSON2String.ts +2 -5
- package/lib/JSON2String.d.ts +1 -3
- package/lib/userInputToJson.d.ts +5 -1
- package/lib/ywfe-tools.cjs +13 -24
- package/lib/ywfe-tools.cjs.map +1 -1
- package/lib/ywfe-tools.esm.js +13 -24
- package/lib/ywfe-tools.esm.js.map +1 -1
- package/lib/ywfe-tools.umd.js +2 -2
- package/lib/ywfe-tools.umd.js.map +1 -1
- package/package.json +1 -1
- package/request.ts +1 -2
- package/userInputToJson.ts +3 -7
package/package.json
CHANGED
package/request.ts
CHANGED
@@ -23,6 +23,7 @@ async function request({ input }: { input: RequestOptions }) {
|
|
23
23
|
};
|
24
24
|
const prefix = getBasePath();
|
25
25
|
let requestUrl = isValidURL(input.url) ? input.url : `${prefix}${input.url}`;
|
26
|
+
console.log('requestUrl',requestUrl,isValidURL(input.url))
|
26
27
|
const fetchOption: { [key: string]: any } = {
|
27
28
|
method: method,
|
28
29
|
headers: {
|
@@ -38,11 +39,9 @@ async function request({ input }: { input: RequestOptions }) {
|
|
38
39
|
const response = await fetch(requestUrl, fetchOption);
|
39
40
|
if (!response.ok) {
|
40
41
|
const message = `An error has occured: ${response.status}`;
|
41
|
-
console.log('req result', message);
|
42
42
|
return { success: false, message };
|
43
43
|
}
|
44
44
|
const result = await response.json();
|
45
|
-
console.log('req result',result);
|
46
45
|
return result;
|
47
46
|
}
|
48
47
|
|
package/userInputToJson.ts
CHANGED
@@ -5,7 +5,6 @@ interface userInput {
|
|
5
5
|
rules?: string;
|
6
6
|
}
|
7
7
|
async function userInputToJson({ input }: { input: userInput }) {
|
8
|
-
console.log("input", input);
|
9
8
|
const res: { message: string; success: boolean; data: any } =
|
10
9
|
await request({
|
11
10
|
input: {
|
@@ -14,11 +13,8 @@ async function userInputToJson({ input }: { input: userInput }) {
|
|
14
13
|
params: input,
|
15
14
|
},
|
16
15
|
});
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
} else {
|
21
|
-
return res.success ? res.data : res;
|
22
|
-
}
|
16
|
+
console.log('userINput1',res)
|
17
|
+
return res
|
18
|
+
|
23
19
|
}
|
24
20
|
export default userInputToJson
|