Skip to content

Commit

Permalink
Merge branch 'categories-page' of https://github.com/TritonSE/DFM-Sid…
Browse files Browse the repository at this point in the history
…eline-Sidekick-App into categories-page
  • Loading branch information
EdwardLinS committed May 27, 2024
2 parents 7bfef06 + 1c1516a commit fe9297b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions admin-portal-frontend/src/app/all-page/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import { useEffect, useState } from "react";
import Filter from "../icons/filter.svg";
import { Category, getAllCategories, deleteCategory } from "../components/categoryRoutes";

import { Category, deleteCategory, getAllCategories } from "../components/categoryRoutes";
import PageContainer from "../components/PageContainer";
import Toast from "../components/Toast";

Expand All @@ -13,10 +14,13 @@ export default function CategoriesPage() {

useEffect(() => {
const fetchData = async () => {
const fetchedCategories = (await getAllCategories()) as Category[];
console.log(fetchedCategories);

setCategories(fetchedCategories as never);
try {
const fetchedCategories = await getAllCategories();
console.log(fetchedCategories);
setCategories(fetchedCategories as never);
} catch (error) {
console.error("Error fetching categories:", error);
}
};

fetchData();
Expand Down Expand Up @@ -92,7 +96,7 @@ export default function CategoriesPage() {
/>
</div>
<button className="flex flex-row items-center gap-2 px-4 py-2 rounded-md text-white bg-[#00629B]">
<img src={Filter?.src as string} alt="Filter" className="w-4 h-4" />
{Filter?.src && <img src={Filter.src} alt="Filter" className="w-4 h-4" />}
<p>Filter</p>
</button>
</div>
Expand Down

0 comments on commit fe9297b

Please sign in to comment.