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

Refactor/#655: 토픽 단일 조회 페이지 레이어 분리 #656

Merged
merged 9 commits into from
May 4, 2024
1 change: 1 addition & 0 deletions frontend/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
printWidth: 100,
singleQuote: true,
};
14 changes: 13 additions & 1 deletion frontend/src/apis/new/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import { TopicCardProps } from '../../types/Topic';
import { ClusteredCoordinates } from '../../pages/SelectedTopic/types';
import { TopicCardProps, TopicDetailProps } from '../../types/Topic';
import { http } from './http';

export const getTopics = (url: string) => http.get<TopicCardProps[]>(url);

export const getProfile = () =>
http.get<TopicCardProps[] | null>('/members/my/topics');

export const getTopicDetail = (topicId: string) =>
http.get<TopicDetailProps[]>(`/topics/ids?ids=${topicId}`);

export const getClusteredCoordinates = (
topicId: string,
distanceOfPinSize: number,
) =>
http.get<ClusteredCoordinates[]>(
`/topics/clusters?ids=${topicId}&image-diameter=${distanceOfPinSize}`,
);
14 changes: 11 additions & 3 deletions frontend/src/hooks/useTags.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { useContext } from 'react';
import { useContext, useEffect } from 'react';

import { TagContext } from '../context/TagContext';
import useNavigator from './useNavigator';

const useTags = () => {
interface Props {
isInitTags: boolean;
}

const useTags = ({ isInitTags }: Props) => {
const { tags, setTags } = useContext(TagContext);
const { routePage } = useNavigator();

Expand All @@ -15,7 +19,11 @@ const useTags = () => {
setTags([]);
};

return { tags, setTags, onClickInitTags, onClickCreateTopicWithTags };
useEffect(() => {
if (isInitTags) setTags([]);
}, []);

return { tags, onClickInitTags, onClickCreateTopicWithTags };
};

export default useTags;
249 changes: 0 additions & 249 deletions frontend/src/pages/SelectedTopic.tsx

This file was deleted.

Loading
Loading