Skip to content

Commit

Permalink
[add] fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ymuichiro committed Nov 17, 2023
1 parent 55f78d5 commit 97c5007
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ const Home: NextPage<Props> = ({ i18n, newsReleases, locale }) => {
date={n.attributes.publishedAt}
locale={locale}
image={`${process.env.NEXT_PUBLIC_API_URL}${n.attributes.headerImage?.data.attributes.url}`}
tweetLink={`${process.env.NEXT_PUBLIC_HOSTING_URL}${NAVIGATIONS.NEWS}/${n.id}`}
link={`news/${n.id}`}
tweetLink={`${process.env.NEXT_PUBLIC_HOSTING_URL}${n.id}`}
link={`${n.id}`}
style={{ height: '100%' }}
/>
</InViewAnimation>
Expand Down Expand Up @@ -476,20 +476,18 @@ const Home: NextPage<Props> = ({ i18n, newsReleases, locale }) => {
const getServerSideProps: GetServerSideProps<Props> = async ({ locale, defaultLocale }) => {
const newsArticles = await findNewsRelease(locale, { isIncludeMedia: true, page: 1, size: 10 });
const communityArticles = await findCommunityRelease(locale, { isIncludeMedia: true, page: 1, size: 10 });
newsArticles.data = newsArticles.data
.map((article) => {
article.attributes.body = 'deleted';
article.attributes.localizations.data = [];
return article;
})
.slice(0, 10);
communityArticles.data = communityArticles.data
.map((article) => {
article.attributes.body = 'deleted';
article.attributes.localizations.data = [];
return article;
})
.slice(0, 10);
newsArticles.data = newsArticles.data.map((article) => {
article.attributes.body = 'deleted';
article.attributes.localizations.data = [];
article.id = `${NAVIGATIONS.NEWS}/${article.id}` as any;
return article;
});
communityArticles.data = communityArticles.data.map((article) => {
article.attributes.body = 'deleted';
article.attributes.localizations.data = [];
article.id = `${NAVIGATIONS.COMMUNITY}/${article.id}` as any;
return article;
});

const articles = [...newsArticles.data, ...communityArticles.data].sort(
(a, b) => new Date(b.attributes.createdAt).getTime() - new Date(a.attributes.createdAt).getTime()
Expand Down

0 comments on commit 97c5007

Please sign in to comment.