Skip to content

Commit

Permalink
Fixed djangoindia#244 -- Created apiDataCard.ts, configured DataCard …
Browse files Browse the repository at this point in the history
…count numbers for fetching actual data - Subscribers explicitly set, Contributors & Stars set by API. Added comments.
  • Loading branch information
ehemp committed Dec 9, 2024
1 parent ad239f7 commit 94bafdd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/DataCard/DataCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';
import React, { useEffect, useState } from 'react';

import { FaCity, FaGithub, FaUsers } from 'react-icons/fa';
import { useInView } from 'react-intersection-observer';
import { url, requestOptions } from './apiDataCard';
Expand All @@ -18,6 +17,7 @@ export const DataCard = () => {
const [dataCount, setDataCount] = useState({stargazers_count: Number, subscribers_count: Number, contributors_count: Number});
const [loading, setLoading] = useState(true);
useEffect(() => {
//Set up use effect so API runs on component load and stops once loading is set to false.
async function fetchDataCount(url1: string, url2: string, options: object): Promise<any> {
try {
if (url1 && url2) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/DataCard/apiDataCard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

//API URL and Headers exported for DataCard.tsx
export const requestOptions = {
options: {method: "GET", headers: {'X-GitHub-Api-Version': '2022-11-28'}},
};
Expand Down

0 comments on commit 94bafdd

Please sign in to comment.