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'; ...@@ -2,7 +2,6 @@ import {useState, useEffect} from 'react';
import Config from '../../config'; import Config from '../../config';
import "./promolistStyle.css"; import "./promolistStyle.css";
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { getAllProducts } from "../../actions/apiRequests.js";
export default function PromotionIndexComponent () { export default function PromotionIndexComponent () {
...@@ -17,6 +16,7 @@ export default function PromotionIndexComponent () { ...@@ -17,6 +16,7 @@ export default function PromotionIndexComponent () {
const response = await fetch(`${Config.promotionsUrl}`); const response = await fetch(`${Config.promotionsUrl}`);
const data = await response.json(); const data = await response.json();
setPromoData(data); setPromoData(data);
console.log(data);
} }
const deletePromotion = (promoId) => { const deletePromotion = (promoId) => {
...@@ -30,7 +30,6 @@ export default function PromotionIndexComponent () { ...@@ -30,7 +30,6 @@ export default function PromotionIndexComponent () {
return ( return (
<div> <div>
<div className="promo-container"> <div className="promo-container">
<div className="promo-list-container"> <div className="promo-list-container">
<div className="promo-header"> <div className="promo-header">
<h1 className="promo-title"> Promotions</h1> <h1 className="promo-title"> Promotions</h1>
...@@ -60,7 +59,7 @@ export default function PromotionIndexComponent () { ...@@ -60,7 +59,7 @@ export default function PromotionIndexComponent () {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{promoData.map((promo, key) => { {promoData.length > 0 && promoData.map((promo, key) => {
return ( return (
<tr key={key}> <tr key={key}>
<td> <td>
...@@ -88,8 +87,8 @@ export default function PromotionIndexComponent () { ...@@ -88,8 +87,8 @@ export default function PromotionIndexComponent () {
</td> </td>
</tr> </tr>
) )
}).reverse() }).reverse() }
}
</tbody> </tbody>
</table> </table>
</div> </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