Skip to content

Commit

Permalink
refactor: fetchGet을 useProfileList로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
GC-Park committed Jan 14, 2024
1 parent 1310d86 commit bf162c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/src/components/TopicCardList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Grid from '../common/Grid';
import Space from '../common/Space';
import Text from '../common/Text';
import TopicCard from '../TopicCard';
import useProfileList from '../../hooks/queries/useProfileList';

interface TopicCardListProps {
url: string;
Expand All @@ -29,11 +30,12 @@ function TopicCardList({
}: TopicCardListProps) {
const [topics, setTopics] = useState<TopicCardProps[] | null>(null);
const { fetchGet } = useGet();
const { data } = useProfileList(url);

const getTopicsFromServer = async () => {
fetchGet<TopicCardProps[]>(url, errorMessage, (response) => {
setTopics(response);
});
if (data !== undefined) {
setTopics(data);
}
};

useEffect(() => {
Expand Down

0 comments on commit bf162c3

Please sign in to comment.