Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed commented out code and logs #162

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion client/src/components/CreateBoardComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ const CreateBoardComponent: React.FC<CreateBoardComponentProps> = ({
Cancel
</button>
</div>
{/* {error && <p className="text-red-500 mt-2">{error}</p>} */}
<ErrorMessage message={error} />
</div>
);
Expand Down
24 changes: 0 additions & 24 deletions client/src/components/SearchGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,13 @@ const SearchGrid = () => {
const { getAllTemplates } = useGetAllTemplates();
const { getCardsFromTemplate } = useGetTemplateCards();

// previous code
// useEffect(() => {
// const fetchTemplates = async () => {
// const templatesFromAPI = await getAllTemplates();

// const updatedTemplates = await Promise.all(
// templatesFromAPI.map(async (template) => {
// const cardsFromAPI = await getCardsFromTemplate(template.uuid);
// const updatedCards = [...cardsFromAPI, newCard];
// return { ...template, cards: updatedCards };
// })
// );
// setAllTemplates(updatedTemplates);
// };

// if (templates.length === 0) {
// // UNCOMMENT WHEN ROUTE IS UP FOR GET ALL TEMPLATES AND GET CARDS FROM TEMPLATE
// // fetchTemplates();
// }
// }, []);

// above code changed to this
const fetchTemplates = async () => {
try {
const templatesFromAPI = await getAllTemplates();
if (templatesFromAPI.length > 0) {
const updatedTemplates = await Promise.all(
templatesFromAPI.map(async (template) => {
const cardsFromAPI = await getCardsFromTemplate(template.uuid);
console.log("CARDS",cardsFromAPI)
const updatedCards = [...cardsFromAPI, newCard];
return { ...template, cards: updatedCards };
})
Expand All @@ -74,7 +51,6 @@ const SearchGrid = () => {
}, []);

useEffect(() => {
console.log("TEMP",templates);
if (templateQuery) {
setTemplates(
allTemplates
Expand Down
14 changes: 0 additions & 14 deletions client/src/context/TemplateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,6 @@ export const TemplateProvider = ({ children }: { children: ReactNode }) => {
console.log("TEMPLATE IS OWNED", templateIsOwned);
}, [templateIsOwned]);

// previous code
// const handleUploadNewTemplate = (template: Board) => {
// // UNCOMMENT WHEN ROUTE IS COMPLETED. MAY NEED ASYNC/AWAIT IF ISSUES UPLOADING ALL AT ONCE
// postNewTemplate(template);
// template.cards!.forEach((card) => {
// if (card.id !== "0") {
// postTemplateCard(card, template.uuid);
// }
// });

// setUploadedTemplateNames((prev) => [...prev, template.name]);
// };

// Above component set up with async/await
const handleUploadNewTemplate = async (template: Board) => {
try {
await postNewTemplate(template);
Expand Down
3 changes: 0 additions & 3 deletions client/src/hooks/useGetTemplateCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ const useGetTemplateCards = () => {
);
setIsLoading(false);

// inspect what's coming from the API
console.log("API Response Data:", response.data);

const cards = response.data.map((datapt: { [x: string]: any }) => {
let details = JSON.parse(datapt["details"]);
const cardDetails: CardDetails = {
Expand Down
1 change: 0 additions & 1 deletion client/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ const Home: React.FC = () => {
}, [isToastSuccess]);

useEffect(() => {
console.log("effect");
const handleKeyPress = (e: KeyboardEvent) => {
if (e.key === "Escape") handleCancel();
};
Expand Down