Files
2025-04-14 01:17:15 +08:00

29 lines
813 B
TypeScript

(async function () {
const res = await fetch("http://all.funjia.top/api/dynamic/list/tag", {
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({name:element.name});
});
})()
function saveData(importData) {
fetch("http://127.0.0.1:1337/api/tags", {
method: "post",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ data: importData })
}).then((res) => {
console.log(res);
}).catch((err) => {
console.log(err)
})
}