Ошибка при обращении серверу

Есть кусочек программы с запросом ( не уверена что он корректен)

try {
    const data = await fetch("http://localhost:3000/api/products", {
      method: "GET",
      headers: { "Content-Type": "application/json" },
    });
    const response = await data.json();
  } catch (e) {
    throw e   
  }
и оттуда мне надо вытащить значения status и data

const responses = [{
  status: 200,
  data: {
    products,
  },
},
{
  status: 404,
  data: {
    products: [],
  },
},
{
  status: 500,
  data: {
    error: 'Server error',
  },
},
{
  status: 200,
  data: null,
},
];

подскажите, что я делаю не так и где у меня ошибка


Вот что дальше идет

if ((response.error = "Server error")) {
    let textError = "Произошла ошибка, попробуйте обновить страницу позже";
    errMes(textError);
  }

  if ((response.product = [] && response.error != "Server error")) {
    let textError = "Список товаров пуст";
    errMes(textError);
  }
  if (response.products) {
    for ....


const response = await fetch("http://localhost:3000/api/products", {
    method: "GET",
    headers: { "Content-Type": "application/json" },
  })

если так укажу то все как надо выходит


Ответы (0 шт):