Commit 8d6ed355 authored by John Lam's avatar John Lam

add promotion imports and dependencies

parent b5efca59
......@@ -2,7 +2,6 @@ import {useState, useEffect} from 'react';
import Config from '../../config';
import "./promolistStyle.css";
import { NavLink } from 'react-router-dom';
import { getAllProducts } from "../../actions/apiRequests.js";
export default function PromotionIndexComponent () {
......@@ -17,6 +16,7 @@ export default function PromotionIndexComponent () {
const response = await fetch(`${Config.promotionsUrl}`);
const data = await response.json();
setPromoData(data);
console.log(data);
}
const deletePromotion = (promoId) => {
......@@ -30,7 +30,6 @@ export default function PromotionIndexComponent () {
return (
<div>
<div className="promo-container">
<div className="promo-list-container">
<div className="promo-header">
<h1 className="promo-title"> Promotions</h1>
......@@ -60,7 +59,7 @@ export default function PromotionIndexComponent () {
</tr>
</thead>
<tbody>
{promoData.map((promo, key) => {
{promoData.length > 0 && promoData.map((promo, key) => {
return (
<tr key={key}>
<td>
......@@ -88,8 +87,8 @@ export default function PromotionIndexComponent () {
</td>
</tr>
)
}).reverse()
}
}).reverse() }
</tbody>
</table>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment