Hi Guys, I’m currently having a trouble with sending form data using post method.
here is my code.
const { entrypoints } = require("uxp");
const { app } = require("indesign");
entrypoints.setup({
commands: {
showAlert: () => showAlert()
},
panels: {
showPanel: {
show({ node } = {}) { }
}
}
});
showAlert = () => {
const dialog = app.dialogs.add();
const col = dialog.dialogColumns.add();
const colText = col.staticTexts.add();
colText.staticLabel = "Congratulations! You just executed your first command.";
dialog.canCancel = false;
dialog.show();
dialog.destroy();
return;
}
login = async () => {
let url = "http://localhost:5000/Login"
let data = new FormData()
data.append('userId', '12321')
await fetch(url, {
method: "POST",
body:data
})
}
here is my manifest file
{
"id": "com.adobe.uxp.indesign.quick.starter",
"name": "Quick Starter",
"version": "1.0.0",
"main": "index.html",
"host": {
"app": "ID",
"minVersion": "18.5.0"
},
"requiredPermissions": {
"network": {
"domains": "all"
}
},
"manifestVersion": 5,
"entrypoints": [
{
"type": "command",
"id": "showAlert",
"label": "Show alert"
},
{
"type": "panel",
"id": "showPanel",
"minimumSize": {"width": 230, "height": 200},
"maximumSize": {"width": 2000, "height": 2000},
"preferredDockedSize": {"width": 300, "height": 300},
"preferredFloatingSize": {"width": 300, "height": 300},
"label": {"default": "Show panel"},
"icons": [
{
"width": 23,
"height": 23,
"path": "icons/dark.png",
"scale": [
1,
2
],
"theme": [
"darkest",
"dark",
"medium"
]
},
{
"width": 23,
"height": 23,
"path": "icons/light.png",
"scale": [
1,
2
],
"theme": [
"lightest",
"light"
]
}
]
}
],
"icons": [
{
"width": 48,
"height": 48,
"path": "icons/plugin.png",
"scale": [
1,
2
],
"theme": [
"darkest",
"dark",
"medium",
"lightest",
"light",
"all"
],
"species": [
"pluginList"
]
}
]
}
when I try to hit the endpoint in shows a blank payload.
Please help, I’m stuck with it for the past few hours…