@jonatandor35 I implemented the code for my “Stories” collection and the log in WIX returns an Error 500. That is how i inserted the code:
export function get_stories () {
let options = {
"headers" : {
"Content-Type" : "application/json" ,
"Access-Control-Allow-Origin" : "*"
}
};
**return** wixData . query ( "Stories" )
. find ()
. then (( results ) => {
let items = results . items ;
if ( items . length > 0 ) {
items = items . map ( e => { e . image = `https://static.wixstatic.com/media/ ${ e . image . split ( '/' )[ 3 ]}`; **return** e ; });
options . body = {
"items" : results . items ,
}
**return** ok ( options );
}
})
// something went wrong
. catch (( error ) => {
options . body = {
"error" : error
};
**return** serverError ( options );
});
}