this function is used for sending the API request
export const socialPostMurmur= (publicKey,content,sig,visibility,video,photo)=>{
// console.log(publicKey,content,sig,visibility,video,photo);
console.log('photo',photo);
let data;
data="pub=" + publicKey.toString() +
"&content=" + content +
"&sig=" + sig.sig +
"&visibility=" + visibility +
"&videos=[]" +
"&photos=" + photo
console.log("data====",data)
fetch('https://murmurjapi.wandx.co/accounts/postMurmur', {
method: 'POST',
headers: new Headers({
"Content-Type": "application/x-www-form-urlencoded", // <-- Specifying the Content-Type
Accept: "application/json"
}),
body:data
}).then((response) => response.json())
.then((responseJson) => {
console.log("New post is called",responseJson);
// return responseJson.movies;
})
.catch((error) => {
console.error('this is error',error);
});
}
the arguments `photo` and `video` in the function are expected to be arrays. When I log `photo`, it correctly displays an array like this:
["QmYTLjw3dzwNVzhMZGVdbZwbt7KTfc51exCWXeTKsy2bff-image-jpg-general"]
however, when the data is sent to the API and printed out, it does not show as an array. The response from the API call shows a status of failed with no error message.
This is how the array is formatted in the API request:
photos=QmYTLjw3dzwNVzhMZGVdbZwbt7KTfc51exCWXeTKsy2bff-image-jpg-general
this is the data that is being sent to the API
console.log("data====",data)
pub=EOS7qoTnhdcdihvcvEBkqNJ21iNwFJURRvgciHCuG2ihsvPZyPdL4&content=H&sig=SIG_K1_JwaNudk7P6AeogY9LSKey7hTwSTYM9E1GsLF3twRgqap6zCFVY78PzZgF1yA6GUTdDuC4vNXo1vUgwFCFKHppsyHc1zGVb&visibility=1&videos=[]&photos=QmYTLjw3dzwNVzhMZGVdbZwbt7KTfc51exCWXeTKsy2bff-image-jpg-general
this is the response received after the API call
New post is called
{status: false, err: {…}}
status: false
err: {}
__proto__: Object