사회이슈 키워드는 최대 3개까지 구독할 수 있어요.
- {MySubscribeData.map((item, idx) => {
+ {mySubData.map((item, idx) => {
return (
{
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
const selectedTab = useRecoilValue(selectedTabState);
+ //
+ const setSubscribeData = useSetRecoilState(mySubscribeTopicData);
+ const setLikeData = useSetRecoilState(myLikeData);
+ const setLikeContents = useSetRecoilState(myLikeContentsData);
+ const setWriteData = useSetRecoilState(myWriteData);
+
useEffect(() => {
const handleResize = () => {
setWindowWidth(window.innerWidth);
@@ -26,6 +44,48 @@ export const RealMyPage = () => {
window.removeEventListener("resize", handleResize);
};
}, []);
+ const accessToken = window.localStorage.getItem("accessToken");
+
+ useEffect(() => {
+ if (accessToken !== null) {
+ getMySubscribeData(accessToken)
+ .then((res) => {
+ // console.log(res.data.data.subscribeResList);
+ setSubscribeData(res.data.data.subscribeResList);
+ })
+ .catch((err) => {
+ console.log(err);
+ });
+
+ //
+ getMyLikeCommunityData(accessToken)
+ .then((res) => {
+ // console.log(res.data);
+ setLikeData(res.data.data);
+ })
+ .catch((err) => {
+ console.log(err);
+ });
+
+ postMyLikeContentsData(accessToken)
+ .then((res) => {
+ console.log(res.data);
+ setLikeContents(res.data.data);
+ })
+ .catch((err) => {
+ console.log(err);
+ });
+
+ getMyWriteCommunityData(accessToken)
+ .then((res) => {
+ // console.log("11", res.data);
+ setWriteData(res.data.data);
+ })
+ .catch((err) => {
+ console.log(err);
+ });
+ }
+ });
return (
diff --git a/src/recoil/atoms/index.ts b/src/recoil/atoms/index.ts
index ee6de61..c68602b 100644
--- a/src/recoil/atoms/index.ts
+++ b/src/recoil/atoms/index.ts
@@ -131,6 +131,23 @@ export const topDateState = atom({
default: "",
});
+export const mySubscribeTopicData = atom({
+ key: "src/atoms/auth.tsx-mySubscribeTopicData",
+ default: [],
+});
+
+export const myLikeData = atom({
+ key: "src/atoms/auth.tsx-myLikeData",
+ default: [],
+});
+
+export const myLikeContentsData = atom({
+ key: "src/atoms/auth.tsx-myLikeContentsData",
+ default: [],
+});
+
+export const myWriteData = atom({
+ key: "src/atoms/auth.tsx-myWriteData",
export const ToastState = atom({
// 주제뱔 상세페이지 접속시, 쿼리스트링의 영역값을 저장
key: "src/atoms/auth.tsx-ToastState ",
diff --git a/src/types/index.ts b/src/types/index.ts
index ea11fee..2032f9b 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -281,6 +281,27 @@ export interface BubbleGraphProps {
name: string;
}
+export interface SubscribeDataProps {
+ //
+ imgUrl: string;
+ issue: string;
+ issueId: number;
+ topic: string;
+}
+
+export interface ContentsItemProps {
+ contents_id: number;
+ imgUrl: string;
+ title: string;
+ description: string;
+ type: string;
+ issueTitle: string;
+ keyword: string;
+ pubDate: string;
+ topic: string;
+ likeCount?: number;
+ quotCount?: number;
+
export interface CommentProps {
topicId: number;
communityId: number;