Skip to content

Commit

Permalink
[Fix] 마지막 피드일 때 서버 오류 수정, 마지막 피드 일 때 나타나는 컴포넌트 수정 #32
Browse files Browse the repository at this point in the history
마지막 피드일 때 없는 프로퍼티에 접근해서 생기는 오류 수정
마지막 피드일때 안내 컴포넌트 추가
  • Loading branch information
WooYeonSeo committed Dec 13, 2019
1 parent ec7b73f commit 9d9457f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
28 changes: 28 additions & 0 deletions client/src/composition/Feed/NoFeed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useEffect } from 'react';
import React from 'react';
import styled from 'styled-components';
interface Props {
onClick: (event: React.MouseEvent<HTMLElement>) => void;
onEffect: () => void | (() => void);
data: string;
}
const NoFeedGuide = styled.div`
border: 1px solid #dadde1;
display: inline-block;
cursor: pointer;
width: 510px;
text-align: center;
padding: 0.5rem 0.75rem;
border-radius: 2rem;
font-size: 14px;
background: white;
box-shadow: 0.5px 0.5px 2p x 0px #dadde1;
`;

const NoFeed = () => {
return (
<NoFeedGuide>마지막 피드입니다. 새로운 친구를 만들어보세요~</NoFeedGuide>
);
};

export default NoFeed;
3 changes: 2 additions & 1 deletion client/src/composition/Feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import useIntersect from 'hooks/useIntersectObserver';
import styled from 'styled-components';
import WritingFeed from './WritingFeed';
import NewFeedAlarm from './NewFeedAlarm';
import NoFeed from './NoFeed';
import { useGetfeedsQuery, useMeQuery } from 'react-components.d';
import { dateToISO, objToDate } from '../../utils/dateUtil';
import { FEEDS_SUBSCRIPTION } from './feed.query';
Expand Down Expand Up @@ -169,7 +170,7 @@ const FeedList = () => {
<></>
)}

<div>is End</div>
<NoFeed></NoFeed>
</>
);
};
Expand Down
7 changes: 7 additions & 0 deletions server/src/api/feed/feed.resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ const queryResolvers: QueryResolvers = {
});

const feeds = parseResultRecords(result);

if (feeds.length === 0) {
return {
cursor: '',
feedItems: feeds
};
}
const lastFeed = feeds[feeds.length - 1];
const cursorDate = lastFeed.feed.createdAt;
const cursorDateType = objToDate(cursorDate);
Expand Down

0 comments on commit 9d9457f

Please sign in to comment.