WIX API fetch to repeater

I am experiencing issues populating wix API fetched data to a repeater, though i did follow some example here i get an error, not sure why…

Link to a example: Wix: Populate repeater with external API call

here is the error:

Wix code SDK error: Each item in the items array must have a member named `_id` which contains a unique value identifying the item.
Wix code SDK Warning: The data that was passed to data contained at least two items with the same ID: . Only the first item was accepted.

my current code

import {getCurrentTemp} from 'backend/serviceModule';

//...

    export function buttonFetch_click(event, $w) {
      getCurrentTemp($w("#emailInput").value)
        .then(CurrentTemp => {
          // add an _id property to each  object
          CurrentTemp.forEach(item => item._id = item.id)
          // feed the data to the repeater
          $w('#repeater1').data = CurrentTemp;
        } );
    }

    export function repeater1_itemReady($item, itemData, index) {
      $item("#textResults").text = "Name: " + itemData.Title + "\n"
        + "Symbol: " + itemData.BreachDate + "\n"
        + "Rank: " + itemData.Description + "\n"
        + "Price (USD): " + itemData.DataClasses;
    }

From the error message that you get, it appears as if the data returned by getCurrentTemp() does not have an id field [(item.id]((item.id) is null or undefined), or that more than one item that was returned has the same id.

You should add a console.log(CurrentTemp); statement to see what you’re getting.

I assume the API you are using, when returning an array, each item has some identifying attribute? if so, you can just do a simple transform like -

let CurrentTemp = CurrentTemp.map(item => {
  item._id = String(item.ID); 
  return item;
});
$w("#repeater1").data = CurrentTemp;

This is a year old thread and is being closed.