Skip to content

Commit

Permalink
fix: groupId 픽스
Browse files Browse the repository at this point in the history
  • Loading branch information
namdaeun committed Jan 17, 2024
1 parent 8caed12 commit b9b7c12
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
6 changes: 2 additions & 4 deletions src/pages/groupFeed/components/MyGroupBtn.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import styled from '@emotion/styled';
import { useNavigate } from 'react-router-dom';

import { groupPropTypes } from '../../main/apis/getGroupContent';

const MyGroupBtn = ({ moimId }: groupPropTypes) => {
const MyGroupBtn = () => {
const navigate = useNavigate();
const handleRoutingGroupFeed = () => {
navigate(`/group/${moimId}`);
navigate(`/group/MQ==`);
};

return <MyGroupBtnWrapper onClick={handleRoutingGroupFeed}>내 글 모임</MyGroupBtnWrapper>;
Expand Down
5 changes: 2 additions & 3 deletions src/pages/main/apis/getGroupContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { client } from '../../../utils/apis/axios';

export interface groupPropTypes {
moimId: string;
moimName: string;
moimPosts: groupPostTypes[];
moimName?: string;
moimPosts?: groupPostTypes[];
}

interface getGroupContentResponseTypes {
Expand All @@ -19,7 +19,6 @@ interface getGroupContentResponseTypes {
export const getGroupContent = async () => {
try {
const { data } = await client.get<getGroupContentResponseTypes>('/api/moim/best');
console.log(data.data.moim);
return data.data.moim;
} catch (error) {
console.error(error);
Expand Down
17 changes: 10 additions & 7 deletions src/pages/main/components/GroupContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { useNavigate } from 'react-router-dom';

import CuriousGroup from './CuriousGroup';

import { groupPropTypes } from '../apis/getGroupContent';

import Spacing from './.././../../components/commons/Spacing';

export interface groupContentPropTypes {
Expand All @@ -17,13 +15,18 @@ export interface groupContentPropTypes {
isLast: boolean;
}

const GroupContent = (
{ topicName, imageUrl, postTitle, postContent, groupId, postId, isLast }: groupContentPropTypes,
{ moimId }: groupPropTypes,
) => {
const GroupContent = ({
topicName,
imageUrl,
postTitle,
postContent,
groupId,
postId,
isLast,
}: groupContentPropTypes) => {
const navigate = useNavigate();
const handleOnClick = () => {
navigate(`/detail/${moimId}/${postId}`);
navigate(`/detail/${groupId}/${postId}`);
};
const hasImage = () => {
return imageUrl !== null;
Expand Down
8 changes: 3 additions & 5 deletions src/pages/main/components/MainHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import styled from '@emotion/styled';
import { useNavigate } from 'react-router-dom';

import { groupPropTypes } from '../apis/getGroupContent';

import { HeaderLogoIc } from '../../../assets/svgs';
import LogInOutBtn from '../../../components/commons/LogInOutBtn';
import theme from '../../../styles/theme';
Expand All @@ -11,18 +9,18 @@ import MakeGroupBtn from '../../groupFeed/components/MakeGroupBtn';
import MyGroupBtn from '../../groupFeed/components/MyGroupBtn';

// 메인 페이지 헤더
export const LogInHeader = ({ moimId, moimName, moimPosts }: groupPropTypes) => {
export const LogInHeader = () => {
const handleLogOut = () => {
logout();
alert('로그아웃 되었습니다');
location.reload();
};

//MQ==
return (
<HeaderWrapper>
<HeaderLogoIc />
<HeaderBtnLayout>
<MyGroupBtn moimId={moimId} moimName={moimName} moimPosts={moimPosts} />
<MyGroupBtn />
<CommonBtnLayout>
<MakeGroupBtn />
<LogInOutBtn onClick={handleLogOut}>로그아웃</LogInOutBtn>
Expand Down

0 comments on commit b9b7c12

Please sign in to comment.