Error dropdown list with json API

I have a test api where I would like it to be displayed in the dropdown.
The backend code is returning a null value. Page code I tried to follow an example of a user here on the forum and was unsuccessful. can anybody help me ?

PAGE CODE
import { manualApi_vs1 } from 'backend/manualAPI_vs2';
import { session } from 'wix-storage';
import wixData from 'wix-data';

let equipamentos = session. getItem("equipamentos");

$w.onReady(function () {
    manualApi_vs1(equipamentos)
 . then((Equipamentos) => {
            console. log(Equipamentos);
 const uniqueTitles = getUniqueTitles(Equipamentos. id);
            $w("#dropdown1"). options = buildOptions(uniqueTitles);

 });

 function getUniqueTitles(items) {
 const titlesOnly = items. map(item => item. line_1);
 return [ ... new Set(titlesOnly)];
 }

 function buildOptions(uniqueList) {
 return uniqueList. map(curr => {
 return { label: curr, value: curr };
 });
 }
})

BACKEND CODE
import { fetch } from 'wix-fetch';

export function manualApi_vs1(equipamentos) { 
 // const url = 'http:// 3b88a1d8ac67. ngrok. io/equipamentos/?format=json';
 // console. log("Url: " + url);

 const url = 'http://3b88a1d8ac67. ngrok. io/equipamentos/'; 
    console. log("Url: " + url + equipamentos + '/?format=json'); 
 let fullUrl = url + equipamentos + '/?format=json';
 
 return fetch(fullUrl, { "method": "get" }) 
 . then((httpResponse) => { 
 if (httpResponse. ok) {
 let Equipamentos = httpResponse. json(); 
 return Equipamentos; 
 }
 }) 
}

response.json() is a promise and you’re not waiting for it.
it should be:

//...
.then(async response =>  {
if(response.ok){
let eq = await response.json();
}
//...

P.S. next time, please copy-paste the code instead of posting screenshots. it saves typing time :slight_smile:

P.S. I’m moving it to the coding community

Thank you, I put the code to make it easier.

Still still wrong. :c
The PAGE CODE part is not showing the names in the dropdown

@leticialima

  1. Does this line console . log ( Equipamentos ); show the expected result?

  2. It’s hard to add any insights if you don’t describe what Equipamentos stand for. Is it an array? Something else?

@jonatandor35 sorted out! tks