Ok, I fighting... I change the code and I have error 400.. but I don't have the message, just the error code.. (response.status)).. the others resorce.log / 'response' return null.. some idea to discover the problem?
PS: O tried base64 to, but I think, the correct its local path..
Thanks again..
const { Input1, local, base64 } = inputs;
const url = 'https://flespi.io/storage/cdns/all/files';
const formData = new FormData();
//const file = {
// uri: inputs.local,
//};
formData.append("file", inputs.local); //path local
//console.log(inputs.local);
try {
const response = await fetch(url, {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "multipart/form-data",
"Authorization": "FlespiToken ...",
},
body: formData,
});
if (!response.ok) {
// throw new Error("Unable to upload file to endpoint.");
console.log("1 " + response.data);
console.log("2 " + response.status);
console.log("2 " + response.status.message);
console.log( response.headers);
console.log( response.body);
console.log( response.json);
console.log( response.parsed);
console.log( response.error);
console.log("4 " + response.message);
console.log("5 " + response.response);
console.log("6 " + response.result);
console.log("7 " + response.log);
}
const parsed = await response.json();
return [
0,
{
result: response.status,
},
];
} catch (error) {
console.log(error);
console.log("8 " + error.data);
//console.log("9 " + error.status);
//console.log("10 " + error.headers);
//console.log("11 " + error.message);
// console.log("12 " + error.response);
return [
1,
{
result:response.status,
},
];
}