first commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
(async function () {
|
||||
const res = await fetch("http://all.funjia.top/api/dynamic/list/dataDict", {
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ "page": 1, "pageSize": 100000, "userId": "cl3fqx6zb000034ny90rd333s" })
|
||||
});
|
||||
|
||||
const importData = await res.json();
|
||||
importData.data.forEach(element => {
|
||||
console.log(element)
|
||||
saveData({ unionKey: element.unionKey, value: element.value, desc: element.desc });
|
||||
});
|
||||
})()
|
||||
|
||||
function saveData(importData) {
|
||||
fetch("http://127.0.0.1:1337/api/data-dicts", {
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ data: importData })
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user